(function(m){var p=window.AmazonUIPageJS||window.P,q=p._namespace||p.attributeErrors,f=q?q("SimilaritiesDetailJS",""):p;f.guardFatal?f.guardFatal(m)(f,window):f.execute(function(){m(f,window)})})(function(m,p,q){m.when("jQuery","A").execute("sims-bind-parse-aui",function(f,d){function n(){var k=d.parseJSON;d.each(f('script[type\x3d"a-state"]'),function(h){h=f(h);if(!h.data("a-eval")){var g=h.attr("data-a-state");if(g&&(g=k(g),g.key&&-1!==f.inArray(g.key,l))){var a=k(h.html());d.state.replace(g.key, a);h.data("a-eval",!0)}}})}var l=["sims-fbt","sims-list","view_to_purchase-sims-weblab-state"];d.on("a:pageUpdate",function(){n()})});m.when("jQuery","A","a-checkbox","p13n-sc-util","p13n-sc-call-on-visible","p13n-sc-logger").register("sims-fbt",function(f,d,n,l,k,h){function g(a){var b=this,c=a.data("sims-fbt-instance");if(c)return c;a.data("sims-fbt-instance",b);b.hasLazyInitialized=!1;f(".sims-fbt-checkbox input").show();b.$fbtRootElement=a;b.$detailsLinkText=b.$fbtRootElement.find(".sims-fbt-details-link a"); b.auiCheckboxes=[];c=this.$fbtRootElement.find("div.sims-fbt-checkbox");this.numOfItems=c.length;for(var e=0;ea?b=b.add(this.plusSigns[c-1]):c)(.*)(<\/span>)/,e=0,f=a=0,d=0,h=1;if(0===b.length)this.$totalPriceDiv.hide();else{for(var g=0;gMath.abs(a)&&(b="0"+b);return b},updateSellerText:function(a){var b="",c="",e="",e=0;if(this.haveDetails){for(c=1;c<=this.numOfItems;c++)this.auiCheckboxes[c-1].isChecked()&&(b+=c,e++);c=0===e?this.getString("noDetails"):1===e?"":"seller"===this.FBTData.shippingDetails[b]?this.getString("differentSellers"):"availabilityone"===this.FBTData.shippingDetails[b]?this.getString("differentAvailabilityOne"): "availabilitysome"===this.FBTData.shippingDetails[b]?this.getString("differentAvailabilitySome"):"";e=0===e?"":""===c?this.getString(a?"hideDetailsLong":"showDetailsLong"):this.getString(a?"hideDetails":"showDetails");c!==this.$detailsText.text()&&this.$detailsText.text(c);e!==this.$detailsLinkText.text()&&this.$detailsLinkText.text(e)}},getString:function(a){return this.FBTData&&this.FBTData.fbtStrings?this.FBTData.fbtStrings[a]:q}};(function(){function a(){return f("#sims-fbt-content").data("sims-fbt-instance")} function b(){var a=f("#sims-fbt-content");a.length&&new g(a)}d.declarative("help-link-click","click",function(a){a.$event.preventDefault();p.open(a.$event.target.href,"AmazonHelp","width\x3d550,height\x3d550,resizable\x3d1,scrollbars\x3d1,toolbar\x3d0,status\x3d0").focus();return!1});d.declarative("details-link-click","click",function(b){b.$event.preventDefault();(b=a())&&b.toggleSellerInfo()});d.declarative("fbt-checkbox-click","change",function(b){var e=a();e&&e.handleCheckboxChange(b)});d.state.bind("sims-fbt", b);d.on("afterReady",b)})();return g});m.when("A","jQuery","p13n-sc-call-on-visible","p13n-sc-logger").execute("sims-vtp-logger",function(f,d,n,l){var k=d(".vtp-container");0m?50-m:10,t=1,t=0,x=(new Date).getTime(),setTimeout(function(){var m= q.scrollTop(),c=a("#miniATFUDP");if(0=d.length||0>=d.height())d=a("#buyxgety_feature_div");var b=d,d=Number.MAX_VALUE;if(b&&0d?!v&&c.is(":hidden")&&(c.removeClass("a-hidden"),c.slideDown(200)):(c.slideUp(200),v=0)}},m))}b=a("#miniATFUDP");var z=a("#miniATFPartialSelection")[0],n=a(".twister-dropdown-highlight")[0];if(!(0>=b.length)){var q,v=0,x=0,t=0,r={},u=0,w=0,y="T2";r.setMiniATFShowHeight=function(a){y=a};r.setMiniATFScrollUpHeight= function(b){w=0;"T1"===b&&(b=a("#productTitle"),0this.ttl&&delete this.data[a]}}}function h(b){var c=b;if("object"===typeof b){var k="",c="";a.each(b,function(a,b){c+= k+b+"\x3d"+a;k="\x26"})}return c}var c;b.prototype={put:function(a,b){a=h(a);b={timestamp:Math.round((new Date).getTime()/1E3),value:b};this.data[a]=b},get:function(a){this.deleteTtlExpiredEntries();if(this.exists(a))return a=h(a),this.data[a].value},exists:function(a){this.deleteTtlExpiredEntries();return h(a)in this.data}};return b});"use strict";e.register("dp-util-cookie",function(){return function(a){a+="\x3d";for(var b=decodeURIComponent(document.cookie).split(";"),h=0;he&&(e=c.interactiveTime):r.push(a.name))},this),r.length||(f=!0)):(c=this.getComponent("default").getTimeToInteractivity(a.events),f=c.interactive,e=c.interactiveTime);return{interactive:f,interactiveTime:f?e:0}},getComponent:function(b){b=b.toLowerCase();this._components[b]||(this._components[b]=new a(b));return this._components[b]},updateFeatureInformation:function(a){var c={timestamp:a.timestamp,type:a.type, options:{}},e=!1;l(a.options)?b.each(a.options.components,function(a){g.isPlainObject(a)&&d(a.name)&&(c.options=a,a=this.getComponent(a.name).updateComponentInformation(c),e=e||a)},this):(c.options=a.options||{},e=this.getComponent("default").updateComponentInformation(c));return e}};return c});e.when("A","dp-interactive-feature","3p-promise").register("dp-time-to-interactive",function(a,b,h){function c(a){d.ue&&d.ue.tag&&d.ue.tag(a)}function l(a,b,c,d){"function"===typeof uet&&uet(a,b,c,d)}function g(a, b,c){"function"===typeof uex&&uex(a,b,c)}function k(b,c){d.ue&&a.$.isFunction(d.ue.count)&&(c=c||(d.ue.count(b)||0)+1,d.ue.count(b,c))}function p(a){return"string"===typeof a&&0c.interactiveTime&&(c.interactiveTime=m.interactiveTime,c.longPoleFeatureName=b)):d.push(b)):d.push(b)},this),d.length||(c.allFeaturesInteractive=!0),c.nonInteractiveFeatures=d);return c},updateFeatures:function(b){b=b||[];var c=!1;f.isArray(b)&&a.each(b,function(a){var b=!1;f.isPlainObject(a)&&p(a.name)&&a.timestamp&&(b=this.getFeatureObject(a.name).updateFeatureInformation(a));c=c||b},this);this._clickToCI.allFeaturesInteractive|| this.getClickToCI();return c},getFeatureObject:function(a){a=a.toLowerCase();this._features[a]||(this._features[a]=new b(a));return this._features[a]},getClickToCI:function(){if(this._clickToCI.isCriticalFeaturesKnown&&!this._clickToCI.metricInfo.allFeaturesInteractive&&(this._clickToCI.metricInfo=this.getTimeToInteractivity(this._clickToCI.criticalFeatures),this._clickToCI.metricInfo.allFeaturesInteractive)){r.resolvePromise(a.copy(this._clickToCI.metricInfo));var b=this._clickToCI.criticalFeatures; f.isPlainObject(b.atc)?(b=b.atc,c("DPCIFBuyable"),b.hasComponents&&f.isArray(b.components)&&(b=b.components[0],f.isPlainObject(b)&&p(b.name)&&c("DPCIFBuyable-"+b.name))):c("DPCIFNonBuyable");n(this._clickToCI.criticalFeatures);b=this._clickToCI.metricInfo;c("DPCIFLongPole"+b.longPoleFeatureName);l("cf","clickToCI",{wb:1},b.interactiveTime);l("fn",void 0,void 0,b.interactiveTime);g("ld","clickToCI",{wb:1});d.ue&&ue.isl&&g("at")}return a.copy(this._clickToCI.metricInfo)},getClickToCIPromise:function(){return r.getPromise()}, setCriticalFeatures:function(a){this._clickToCI.isCriticalFeaturesKnown||!f.isPlainObject(a)||f.isEmptyObject(a)||(this._clickToCI.criticalFeatures=a,this._clickToCI.isCriticalFeaturesKnown=!0,this.getClickToCI())},_parseCriticalFeatures:function(b){var d={};f.isPlainObject(b)?(a.each(b,function(a,b){d[b]={};f.isPlainObject(a)&&(d[b]=a)}),f.isEmptyObject(d)?c("DPCIFNoData"):this.setCriticalFeatures(d)):c("DPCIFNoData")}};e.when("atf").execute("dp-get-critical-interactive-features",function(){var a= {},b=f(".dp-cif");b.length?(b.each(function(){var b=(f(this).data()||{}).featureDetails;f.isPlainObject(b)&&p(b.name)?a[b.name]=b:k("DPCIFInvalidData")}),q._parseCriticalFeatures(a)):c("DPCIFNoData")});return q});e.when("A").register("dp-interactive-feature-component",function(a){function b(a){this.name=a;this._renderTime=0;this._isInteractive=!0;this._events={}}var d=a.$;b.prototype={updateComponentInformation:function(a){var b=!1;if(d.isPlainObject(a))switch(a.type){case "render":b=this._updateRenderInformation(a); break;case "interactive":b=this._updateInteractiveInformation(a)}return b},_updateRenderInformation:function(a){var b=!1,d=a.options||{};this._renderTime||(this._renderTime=a.timestamp,this._isInteractive=void 0===d.isInteractive?!0:d.isInteractive,b=!0);return b},_updateInteractiveInformation:function(b){var d;d=b.options||{};var e=!1;this._isInteractive&&(d=d.events||["click"],a.each(d,function(a){this._events[a]||(this._events[a]={name:a,interactiveTime:b.timestamp},e=!0)},this));return e},getTimeToInteractivity:function(b){var e= 0,g=!1,k=[];this.isRendered()&&(this._isInteractive?(d.isArray(b)||(b=["click"]),a.each(b,function(a){var b=this._events[a];b?b.interactiveTime>e&&(e=b.interactiveTime):k.push(a)},this),k.length||(g=!0,this._renderTime>e&&(e=this._renderTime))):(g=!0,e=this._renderTime));return{interactive:g,interactiveTime:g?e:0}},isRendered:function(){return!!this._renderTime}};return b})}); /* ******** */ (function(c){var b=window.AmazonUIPageJS||window.P,d=b._namespace||b.attributeErrors,a=d?d("DetailPageCommonOffersAssets",""):b;a.guardFatal?a.guardFatal(c)(a,window):a.execute(function(){c(a,window)})})(function(c,b,d){}); /* ******** */ (function(a){var b=window.AmazonUIPageJS||window.P,d=b._namespace||b.attributeErrors,c=d?d("DeliveryStaticPackard",""):b;c.guardFatal?c.guardFatal(a)(c,window):c.execute(function(){a(c,window)})})(function(a,b,d){a.when("A","GLUXWidget").execute(function(c,a){c.on("packard:glow:destinationChangeAll",function(){b.location.reload()})});a.when("A","GlowTriggerMetrics","a-modal").execute(function(c,b,e){c.declarative("dpContextualIngressPt","click",function(a){b.logGLOWTriggerCountFromIngress(b.getEvents().cip.desktop); var d=e.get(c.$("#nav-global-location-slot"));d&&(a.$event.preventDefault(),d.show())})});a.when("A").register("GlowTriggerMetrics",function(c){var a={cip:{desktop:"cip.desktop",mobileWeb:"cip.mobileWeb",tabletApp:"cip.tabletApp",mobileApp:"cip.mobileApp",micron:"cip.micron"},glowTop:{tabletApp:"glow-top.tabletApp",mobileApp:"glow-top.mobileApp",micron:"glow-top.micron"},gpsOnLoad:{nativeApp:"gpsOnLoad.nativeApp"},unknown:{nativeApp:"unknown.nativeApp"}};return{getEvents:function(){return a},logGLOWTriggerCountFromIngress:function(a){a= "GLOWTrigger."+a;b.ue?b.ue.count(a,1):(a="Failed to increment metrics counter: "+a+" because window.ue is not present.",b.ueLogError&&a&&b.ueLogError({message:a},{logLevel:"ERROR",attribution:"GLOWTrigger"}))}}})}); /* ******** */ (function(k){var m=window.AmazonUIPageJS||window.P,r=m._namespace||m.attributeErrors,b=r?r("DeliveryStatic",""):m;b.guardFatal?b.guardFatal(k)(b,window):b.execute(function(){k(b,window)})})(function(k,m,r){k.when("A","jQuery","ready").register("DeliveryCountdownComponent",function(b,a){function h(a,b,c,d,e){this.strings=a;this.asin=b;this.deliveryMessageSectionId=c;this.countdownElementId=d;this.secondsLeft=e;this.intervalHandle=null}m.DeliveryCountdownHandler=function(a){var b=a.strings,c=a.asin, d=a.deliveryMessageSectionId,e=a.fastCountdownElementId,n=a.cheapCountdownElementId;this.cheapCountdownTimer=this.fastCountdownTimer=null;this.start=function(a,l){0e+c}return!1},c=function(c){c.find(".a-button-close").hide();c.find(".a-popover-content").css({"margin-right":"0px"});c.css({padding:"0"});c.find(".a-popover-inner").css({padding:"0"});setTimeout(function(){c.removeClass("a-arrow-bottom");a("#atwl-rich-content").css({"margin-bottom":"0px",width:"auto"});var d=k.getState("atwl");if(d.hzPopover){var h=document.getElementById(d.activePopoverButtonId);if(null!== h&&"undefined"!==typeof h){var g=h.getBoundingClientRect().left;b.capabilities.rtl&&(g=a(p).width()-h.getBoundingClientRect().right);c.css({left:g+"px"})}}a.browser.msie&&(g=a("#"+d.wishlistButtonSubmitId),d=g.offset(),h=g.height(),g=d.left,d=d.top+h,f()&&(g+=document.body.parentElement.scrollLeft,d+=document.body.parentElement.scrollTop),e()&&(g-=17),c.css({left:g+"px",top:d+"px"}))},50)},A=function(c){var b;b=f()?50:0;setTimeout(function(){var b=a("#atwl-popover-inner"),d=b.width(),h=k.getState("atwl"), g=document.getElementById(h.activePopoverButtonId);h.hzPopover&&null!==g&&"undefined"!==typeof g?d=g.getBoundingClientRect().width:e()?d+=r.overflowWidth:a(".atwl-dd-list-name").each(function(c){c=a(this);c.width(c.width()+r.noOverflowWidth)});h=c.find("ul li a.a-active").first();h.css("margin-left","1px");h.parent().focus();b.width(d)},b)},v=function(){if(q){var c=d.get(q);c&&c.hide()}},x=function(b){var e=r.widthStaticPopovers;try{e=document.getElementById("add-to-wishlist-button-group").clientWidth}catch(h){}a("#"+ b).children().first().width(e);v();if(d){var g=d.get(q),f=k.getState("atwl"),g=g?d.get(q):d.create(a("#"+f.activePopoverButtonId),{content:a("#"+b).html(),name:"atwl",skin:function(c){return c},activate:"onmouseclick",width:e,position:f.dropDownPosition||"triggerBottom"});g.update({width:e,content:a("#"+b).html()});q=g.id;g.show().updatePosition();c(g.$popover)}},m=function(){g();h++;v();x("atwl-dd-error-holder")},t=function(){var c=k.getState("atwl");return d.create(a("#"+c.activePopoverButtonId), {content:l(),name:"atwl",skin:function(c){return c},activate:"onmouseclick",position:c.dropDownPosition||"triggerBottom"})},D=function(a){a.update({content:l(),width:"auto"});a.show();c(a.$popover);A(a.$popover)},w=function(){var c=d.get("atwl");c&&c.isActive()?c.hide():(c=t(),d.remove(c),c=t(),D(c),b.capabilities.touch&&setTimeout(function(){var c=a("#wishlistButtonStack"),b=c.clone(),e=c.parent();c.remove();e.append(b)},300),"function"===typeof p.uet&&p.uet("cf","addToListDropdown",{wb:1}),"function"=== typeof p.uex&&p.uex("ld","addToListDropdown",{wb:1}))},B=function(){var c=d.get("atwl");c&&c.isActive()&&c.hide()},C=function(c,a,b){c.append('\x3cinput type\x3d"hidden" id\x3d"'+a+'" name\x3d"'+a+'" value\x3d"'+b+'"\x3e')};return{makeDropDownArrowInactive:g,getDropDownHtml:l,setDropDownHtml:z,resetDropDownHtml:function(){z("")},resetAjaxFailCount:function(){this.ajaxFailCount=0},hideDropdown:B,hideError:function(){v();var c=k.getState("atwl");return h>=c.maxAjaxFailureCount},showUnavail:function(){v(); v();x("atwl-dd-unavail-holder")},showSpinner:function(){x("atwl-dd-spinner-holder")},parseAjaxResponse:function(c){g();v();var e;if("object"===typeof c)e=c;else try{e=b.parseJSON(c)}catch(d){m();return}"undefined"!==typeof e.html&&"undefined"!==e.css?(z(e.html),c=e.css,a("body").append(c),w()):m()},showError:m,showDropDown:w,setInputRegistryId:function(c,e){"undefined"===typeof e&&(e="wishlist");var d="pop_"+c+"_"+e,h=a(k.atwlFormSelector()),g=h.find(k.popCommandSelector);g.length?g.attr("value", d):C(h,"sourceCustomerOrgListID",d);d=h.find("[name\x3d'registryID']");d.length?d.attr("value",c):C(h,"registryID",c);c=h.find("[name\x3d'registryType']");c.length?c.attr("value",e):C(h,"registryType",e);n({inSubmit:!0});e=h.find("[name\x3d'submit.add-to-registry.wishlist'],[name\x3d'submit.add-to-wishlist']").eq(0);e.length?e.click():b.trigger("addFormSubmit");B();return!1}}});"use strict";m.when("A","a-popover","a-modal","atwl-dropdown-util","atwl-common-util","atwl-inline-util","kbp").execute("atwl-dropdown", function(b,d,k,a,h,q,r){var f=b.$;k=h.getState("popoverState");var n=h.getState("atwl"),g=n.wireDeclaratives,l=function(){var a;a=p.atwlEc?"lists:dp:ech:early":"lists:dp:ech:late";var c=p.ue;c&&c.count(a,(c.count(a)||0)+1)},z=function(e){e.$event&&e.$event.originalEvent&&e.$event.originalEvent.acknowledge&&e.$event.originalEvent.acknowledge(e.$currentTarget.get(0));"function"===typeof p.uet&&p.uet("bb","addToListDropdown",{wb:1});l();h.setAtwlState({activePopoverButtonId:"add-to-wishlist-button-group"}); e.$event?e.$event.preventDefault():e.preventDefault();setTimeout(function(){a.makeDropDownArrowInactive()},0);if("not-allowed"===(e.$target?e.$target:f(e.target)).css("cursor"))return!1;if(a.hideError())return a.showUnavail(),!1;if((e=a.getDropDownHtml())&&e.length)a.showDropDown();else{a.showSpinner();e=h.getState("wishlistDPState");var c="website.wishlist.detail.add";"undefined"!==typeof e.vendorId&&(c=e.vendorId);e={sortMethod:n.sortMethod||0,type:"wishlist",useAll:n.showAllTypes||0,sourceVendorId:c}; c=n.hzPopover?"/hz/wishlist/addtolist":"/gp/registry/atwl/popover.html";c+="?"+f.param(e);f.ajax({url:c,cache:!1,success:a.parseAjaxResponse,error:a.showError})}return!1};if(k.showWishListDropDown||k.isAddToWishListDropDownAuiEnabled||k.showPopover)(function(){var a=f("#"+n.wishlistButtonId),c=f("#"+n.wishlistButtonSubmitId);if(n.inlineJsFix)b.on("wl-drop-down",function(c){z(c)});else a.addClass("a-declarative"),a.attr("data-action","atwl-splitbutton-arrow");c.addClass("a-declarative");c.attr("data-action", "atwl-splitbutton-main");f("#wishListMainButton").addClass("a-declarative").attr("data-action","add-wishlist-declarative");p.atwlEc&&setTimeout(function(){a.click();f("#atwl-dd-spinner-holder").addClass("a-hidden");p.atwlEc=!1},1);p.atwlLoaded=!0})(),h.setAtwlState({resetDropDownHtml:a.resetDropDownHtml}),g||(b.declarative("atwl-splitbutton-arrow","click",z),b.declarative("atwl-dd","click",function(b){b.$event.preventDefault();b=b.data;a.setInputRegistryId(b.id,b.type);return!1}),b.declarative("atwl-dd-dl", "click",function(e){e.$event.preventDefault();a.hideDropdown();q.showSpinner();var c=h.getAsin(),d=h.getSid(),c=f.extend({},{asin:c,sid:d},e.data);b.post("/hz/wishlist/ajax/additem?ref\x3didea_dp_ai",{params:c,success:function(c){c.registryName=e.data.listName;q.addItemResponseHandler(c)},error:q.showError,abort:q.showError});return!1}),b.declarative("atwl-dd-cl","click",function(e){e.$event.preventDefault();a.hideDropdown();q.showSpinner();var c=h.getAsin(),d=h.getSid();b.post("/hz/wishlist/addasin?ref\x3dsmi_cl_dp_add", {params:{asin:c,sid:d,listId:e.data.id,listType:e.data.type},success:function(c){q.addItemResponseHandlerHZCharityList(c)},error:q.showError,abort:q.showError});return!1}),b.declarative("atwl-kbp-landing","click",function(a){a=a.data;var c=h.getAsin();p.open(a.url+("\x26asin\x3d"+c));return!1})),n&&"kbp"===n.sortMethod&&(b.state("atwl",{kbpPromo:{mouseOver:!1,countDown:!1}}),b.ajax("/gp/toys/birthday/atwl-dpx.html",{method:"get",cache:!1,params:{isAUI:1},success:r.showKbpPromoPopover,error:function(){}}), g||(b.declarative("atwl-kbp-promo-mouseover","mouseleave",function(){var a=h.getState("atwl").kbpPromo;a.mouseOver=!1;if(a.countDown){var c=d.get("kbpPromoPopover");c&&(c.unlock().hide(),d.remove(c))}b.state("atwl",{kbpPromo:a})}),b.declarative("atwl-kbp-promo-mouseover","mouseenter",function(){var a=h.getState("atwl").kbpPromo;a.mouseOver=!0;b.state("atwl",{kbpPromo:a})}),b.on("a:popover:hide:kbpPromoPopover",function(){var a=d.get("kbpPromoPopover");a.unlock().hide();d.remove(a)}))),h.setAtwlState({wireDeclaratives:!0})}); "use strict";(function(){var b=!1;m.when("cf").execute(function(){b||(b=!0,d())});m.when("atwl-cf").execute(function(){b||(b=!0,d())});var d=function(){m.now("cf-or-atwl-cf").execute(function(b){"undefined"===typeof b&&p.P.register("cf-or-atwl-cf")})}})();m.when("A","cf-or-atwl-cf").register("atwl-common-util",function(b){var d=b.$,k=function(){return"#"+(a("popoverState").formId||"addToCart")+",#addToWL"},a=function(a){return 0===d('script[data-a-state\x3d"{"key":"'+a+'"}"]').length?{}:b.state(a)|| JSON.parse(d('script[data-a-state\x3d"{"key":"'+a+'"}"]').text())||{}};return{CONST:{widthStaticPopovers:230,overflowWidth:10,noOverflowWidth:10,scrollbarWidth:17},getAsin:function(){var a=d(k()).find("#ASIN").val();"undefined"===typeof a&&(a=d(k()).find("[name^\x3d'ASIN'],[name^\x3d'ASIN.0']").val());return a},getSid:function(){var a=d(k()).find("#session-id").val();"undefined"===typeof a&&(a=d(k()).find("[name\x3d'session-id']").val());return a},ie8NoScroll:function(){return 9>parseInt(d.browser.version, 10)&&document.body&&document.body.parentElement?!(!document.body.parentElement.scrollLeft&&!document.body.parentElement.scrollTop):!1},setRegistryID:function(a){var b=d(k());b.find("[name\x3d'sourceCustomerOrgListID'],[name\x3d'colid'],[name\x3d'wlPopCommand']").attr("value",a);b.find("[name\x3d'submit.add-to-registry.wishlist'],[name\x3d'submit.add-to-wishlist']").eq(0).click();return!1},setAtwlState:function(a){b.state("atwl",d.extend(b.state("atwl")||{},a))},getState:a,clearText:function(a){a.value=== a.defaultValue&&(a.value="")},forceFormSubmit:function(a){var b=a.attr("name");a=a.parents("form");b=d('\x3cinput type\x3d"hidden" /\x3e').attr("name",b).val("1");a.append(d(b));a.submit()},clearPopCommandFields:function(){for(var a=["wlPopCommand","sourceCustomerOrgListID"],b=0;bd.height();)e=e.substr(0,e.length-1),c.html(e+"\x26#133;");d.html(c.html()).height("auto").removeClass(f);c.remove()}})},preventSpinners:function(d,c){void 0===p[d]&&(a.on("a:carousel:"+d+":ajaxSuccess",function(d){a.delay(function(){var f= a.$("#"+c+" li.a-carousel-card-empty");0=b-f){for(c=f;0a.indexOfArray(A,d)?d=b:(b=z(d),t[e]=d=b));b in B||(b=z(b));return B[d]>B[b]?d:b},b);return g(d)}function z(b){var c=a.indexOfArray(A,b),d=A.length-2;if(c===d)return A[d];for(;cc&&(c=arguments[b]);return c};Deal.sortByAsinTimes=function(a,c){return a.status.purchaseStatus.expiresDate- c.status.purchaseStatus.expiresDate};Deal.filterAsinsByState=function(a,c){for(var b=[],d=0;d=c.status.msToStart;c.status.endDate=new Date(a.getTime()+ parseInt(c.status.msToEnd,10));c.status.ended=0>=c.status.msToEnd;c.timeouts.start_timeout&&h.clearTimeout(c.timeouts.start_timeout);c.status.started||(c.timeouts.start_timeout=p.delay(function(){c.status.started=!0;c.signal("change",c)},c.status.startDate.getTime()-(new Date).getTime()));c.timeouts.end_timeout&&h.clearTimeout(c.timeouts.end_timeout);c.status.ended||(c.timeouts.end_timeout=p.delay(function(){c.status.ended=!0;c.signal("change",c)},c.status.endDate.getTime()-(new Date).getTime())); c.timeouts.status_expire_timeout&&h.clearTimeout(c.timeouts.status_expire_timeout);c.timeouts.status_expire_timeout=p.delay(function(){c.status.expired=!0;c.signal("status_expire",c)},c.status.cacheExpiresDate.getTime()-(new Date).getTime())},_init_asin_statuses:function(){var a=this;if(a.asins){for(var c=new Date,b=Deal.filterAsinsByState(a.asins,[Deal.inCartStr,Deal.expiredStr,Deal.waitInLineStr,Deal.pendingAtcStr]),d=0;df&&(f=0);var k=""+e.asin;0=a.status.msToEnd||void 0!==a.status.ended&&null!==a.status.ended&&a.status.ended||void 0!==a.status.endDate&&null!==a.status.endDate&&a.status.endDate=e?_.range(0,b=b)return null;c=0;"CN"==gbResources.getCustomerData("realm")?(c=1,a=10*(1-b/a.price)):a=100*b/a.price;return Math.round(a* Math.pow(10,c))/Math.pow(10,c)},displayable_percent_off:function(a){return a&&"number"===typeof a?"CN"==gbResources.getCustomerData("realm")?(100-a)/10:a:null},format:function(a,c){if(!a)return c;c=this.currencies[a.currency]||this.currencies.other;a=c.format(Deal.commify(a.price,c.decimals));c=Deal.DOM.span();c.innerHTML=a;return c.innerText||c.textContent},getEmptyPriceHash:function(){return{price:null,formattedPrice:null,currency:null}},getEmptyPriceObject:function(){return{maxBasisPrice:Deal.Price.getEmptyPriceHash(), minBasisPrice:Deal.Price.getEmptyPriceHash(),maxDealPrice:Deal.Price.getEmptyPriceHash(),minDealPrice:Deal.Price.getEmptyPriceHash()}},isEmptyPriceObject:function(a){var c=Deal.Price.getEmptyPriceObject();return _.isEqual(a,c)?!0:!1},findMaxMinPrices:function(a,c){if(void 0===a||!a)return Deal.log("Cannot findMaxMinPrices on undefined/null deal obj"),{};if(!a.dealAsinsHash)return Deal.log("Cannot operate on undefined/null dealAsinsHash"),{};var b=null,d=null,e=null,f=null,k;for(k in a.dealAsinsHash){var l= a.dealAsinsHash[k];l.basisPrice&&(null===b?b=l.basisPrice:b.pricel.basisPrice.price&&(d=l.basisPrice));l.dealPrice&&(null===e?e=l.dealPrice:e.pricel.dealPrice.price&&(f=l.dealPrice))}a.dealAsins&&0===a.dealAsins.length&&c&&c.currencyCode&&(null!==c.maxBAmount&&void 0!==c.maxBAmount&&null!==c.minBAmount&&void 0!==c.minBAmount&&(b={price:parseFloat(c.maxBAmount),currency:c.currencyCode}, d={price:parseFloat(c.minBAmount),currency:c.currencyCode}),null!==c.maxDealPrice&&void 0!==c.maxDealPrice&&null!==c.minDealPrice&&void 0!==c.minDealPrice&&(e={price:parseFloat(c.maxDealPrice),currency:c.currencyCode},f={price:parseFloat(c.minDealPrice),currency:c.currencyCode}));a=Deal.Price.getEmptyPriceObject();null!==b&&(a.maxBasisPrice={price:b.price,currency:b.currency,formattedPrice:Deal.Price.format(b)});null!==d&&(a.minBasisPrice={price:d.price,currency:d.currency,formattedPrice:Deal.Price.format(d)}); null!==e&&(a.maxDealPrice={price:e.price,currency:e.currency,formattedPrice:Deal.Price.format(e)});null!==f&&(a.minDealPrice={price:f.price,currency:f.currency,formattedPrice:Deal.Price.format(f)});return a},hasPriceData:function(a){return void 0===a||null===a||void 0===a.max||null===a.max||void 0===a.max.price||null===a.max.price||void 0===a.min||null===a.min||void 0===a.min.price||null===a.min.price||a.min.price>a.max.price?!1:!0},compareTo:function(a,c){if(void 0===a||null===a||void 0===c||null=== c)return Deal.log("Cannot do compareTo on undefined/null prices"),2;var b=2;try{a==c?b=0:a>c?b=1:aa.length?a+"_":a.substring(0,1)+a.substring(a.length-2,a.length)+"_"};Deal.getPlacementID=function(a){if(!a)return Deal.log("Cannot get placement id for undefined/null amabotParams."),"";if(void 0===a.placementID||null===a.placementID)return Deal.log("Cannot get placement id for undefined/null slotName."),"";a=a.placementID;return 5>a.length?a+"_":a.substring(a.length- 4,a.length)+"_"};Deal.addRefTag=function(a,c){var b=/^(.*)\?(.*)$/,d=/^(.*)#(.*)$/,e=/^(.*)\/$/,f=/^(.*)$/;c="ref\x3d"+c;b.test(a)?(e="/",/.*\/\?/.test(a)&&(e=""),a=a.replace(b,"$1"+e+c+"?$2")):d.test(a)?(e="/",/.*\/#/.test(a)&&(e=""),a=a.replace(d,"$1"+e+c+"#$2")):a=e.test(a)?a.replace(e,"$1/"+c):a.replace(f,"$1/"+c);return a};Deal.param_appender=function(a,c){if(!a||!c)return Deal.log("Cannot apend refTags for undefined/null URI/refTag"),"";var b="?";a.match(/\?/)&&(b="?"===a.charAt(a.length-1)? "":"\x26");return a+b+c};Deal.getWidgetCDSRef=function(a){var c=Deal.controller.getAmabotParams(a);a=Deal.configManager[Deal.controller.widgetIdToWidgetNameMap[a]].widgetViewConfig.clickStreamRefMarker;_.isEmpty(c)||(a=a+"_"+Deal.getSlotRefTag(c),a+=Deal.getPlacementID(c));return a};Deal.shouldRecordClickAction=function(a){return null===a||void 0===a?!1:Deal.controller.getDeal(a).impressionAsin?!0:!1};Deal.checkAndSetSSLImageUrl=function(a){if(null===a)return a;if("https:"===h.location.protocol){var c= "images-na.ssl-images-amazon.com";"CN"===gbResources.getCustomerData("realm")&&(c="images-cn.ssl-images-amazon.com");var b=document.createElement("a");b.href=a;b.protocol="https:";b.hostname=c;a=b.href}return a};Deal.findBackBoneDealAsin=function(a,c){return a&&a.dealAsinsHash?_.find(a.dealAsinsHash,function(b){return!c||b.ASIN===c})||null:null};Deal.PurchaseStatusGatherer=Deal.Class({__init__:function(a){a&&(this.deal=a,this.now=new Date,this.timeSensitiveStates={},this.timeSensitiveStates[Deal.inCartStr]= 1,this.timeSensitiveStates[Deal.pendingAtcStr]=1,this.stateAsins={},this.gatherStates())},gatherStates:function(){if(this.deal&&this.deal.dealAsinsHash){for(var a in this.deal.dealAsinsHash){var c=this.deal.dealAsinsHash[a];if(c&&c.status){var b=c.status.state;b&&(void 0===this.stateAsins[b]&&(this.stateAsins[b]=[]),void 0!==this.timeSensitiveStates[b]&&c&&c.status&&null!==c.status.expiresDate&&c.status.expiresDate<=this.now||this.stateAsins[b].push(c))}}for(var d in this.timeSensitiveStates)void 0!== this.stateAsins[d]&&null!==this.stateAsins[d]&&this.stateAsins[d].sort(Deal.sortByPurchaseStatusExpirations)}},hasTimeSensitiveState:function(){if(void 0===this.stateAsins||null===this.stateAsins)return Deal.log("Cannot check if a timesensitive stateexists on undefined/null stateAsins."),!1;var a=!1,c;for(c in this.stateAsins)if((c===Deal.inCartStr||c===Deal.pendingAtcStr||c===Deal.waitInLineStr)&&void 0!==this.stateAsins[c]&&null!==this.stateAsins[c]&&0=a){if(d.disconnect(),null!=d.onTimeoutFunction)d.onTimeoutFunction()}else d.timeString=Deal.getUDPTimeString(a,c,b),null!=d.span&&void 0!=d.span&&(0d?b+("0"+d+n+" "):b+(d+n+" "),b=10>e?b+("0"+e+q+" "):b+(e+q+" "),b=10>a?b+("0"+a+r):b+(a+r)):(b+=e+":",b=10>a?b+("0"+a):b+a);return b};Deal.getOfferListingID=function(a,c){return void 0===a||null===a||void 0===a.dealAsinsHash||null===a.dealAsinsHash||void 0===a.dealAsinsHash[c]||null===a.dealAsinsHash[c]?void 0===a.offerListingID||null===a.offerListingID?null: a.offerListingID:a.dealAsinsHash[c].offerID};Deal.ConvertToPaladinUrl=function(a){return void 0===a||null===a?null:a.replace(/^https?:\/\/[a-z0-9\.\-]*\.amazon.com\//i,h.location.protocol+"//"+h.location.host+"/")};Deal.digitalCategories={US:"16261631 2350149011 154606011 163856011 979455011 1233514011 2402172011".split(" ")};Deal.BookCategories={CN:["658390051"]};Deal.hasDigitalCategory=function(a){var c=gbResources.getCustomerData("realm");return _.intersection(a,Deal.digitalCategories[c]).length? !0:!1};Deal.getWhitelistedBookCategories=function(){var a=gbResources.getCustomerData("realm");return Deal.BookCategories[a]||[]};Deal.isDealInEarlyAccessWindow=function(a){var c=!1;a.detail&&(a.detail.accessType===Deal.accessTypeEnum.PRIME_EARLY_ACCESS||a.detail.accessType===Deal.accessTypeEnum.APP_EARLY_ACCESS)&&a.status&&0>=a.status.msToStart&&-a.status.msToStart=d.computed&&(d={value:b,computed:e})});return d.value};g.min=function(b,a,c){if(!a&&g.isArray(b))return Math.min.apply(Math, b);if(!a&&g.isEmpty(b))return Infinity;var d={computed:Infinity};u(b,function(b,e,f){e=a?a.call(c,b,e,f):b;ea?1:0}),"value")};g.groupBy=function(b, a){var c={},d=g.isFunction(a)?a:function(b){return b[a]};u(b,function(b,a){a=d(b,a);(c[a]||(c[a]=[])).push(b)});return c};g.sortedIndex=function(b,a,c){c||(c=g.identity);for(var d=0,e=b.length;d>1;c(b[f])=arguments.length&&(a=b||0,b= 0);c=arguments[2]||1;for(var d=Math.max(Math.ceil((a-b)/c),0),e=0,f=Array(d);e=b?a():function(){if(1>--b)return a.apply(this,arguments)}};g.keys=I||function(b){if(b!==Object(b))throw new TypeError("Invalid object");var a=[],c;for(c in b)g.has(b,c)&&(a[a.length]=c);return a};g.values=function(b){return g.map(b,g.identity)};g.functions=g.methods=function(b){var a=[],c;for(c in b)g.isFunction(b[c])&&a.push(c);return a.sort()};g.extend=function(b){u(f.call(arguments,1),function(a){for(var c in a)b[c]= a[c]});return b};g.defaults=function(b){u(f.call(arguments,1),function(a){for(var c in a)null==b[c]&&(b[c]=a[c])});return b};g.clone=function(b){return g.isObject(b)?g.isArray(b)?b.slice():g.extend({},b):b};g.tap=function(b,a){a(b);return b};g.isEqual=function(b,a){return h(b,a,[])};g.isEmpty=function(b){if(g.isArray(b)||g.isString(b))return 0===b.length;for(var a in b)if(g.has(b,a))return!1;return!0};g.isElement=function(b){return!(!b||1!=b.nodeType)};g.isArray=e||function(b){return"[object Array]"== l.call(b)};g.isObject=function(b){return b===Object(b)};g.isArguments=function(b){return"[object Arguments]"==l.call(b)};g.isArguments(arguments)||(g.isArguments=function(b){return!(!b||!g.has(b,"callee"))});g.isFunction=function(b){return"[object Function]"==l.call(b)};g.isString=function(b){return"[object String]"==l.call(b)};g.isNumber=function(b){return"[object Number]"==l.call(b)};g.isNaN=function(b){return b!==b};g.isBoolean=function(b){return!0===b||!1===b||"[object Boolean]"==l.call(b)};g.isDate= function(b){return"[object Date]"==l.call(b)};g.isRegExp=function(b){return"[object RegExp]"==l.call(b)};g.isNull=function(b){return null===b};g.isUndefined=function(b){return void 0===b};g.has=function(b,a){return n.call(b,a)};g.noConflict=function(){a._=c;return this};g.identity=function(b){return b};g.times=function(b,a,c){for(var d=0;d/g,"\x26gt;").replace(/"/g,"\x26quot;").replace(/'/g, "\x26#x27;").replace(/\//g,"\x26#x2F;")};g.mixin=function(b){u(g.functions(b),function(a){J(a,g[a]=b[a])})};var K=0;g.uniqueId=function(b){var a=K++;return b?b+a:a};g.templateSettings={evaluate:/<~([\s\S]+?)~>/g,interpolate:/\$\(([\s\S]+?)\)/g,escape:/~\$\(([\s\S]+?)\)/g};var D=/.^/,E=function(b){return b.replace(/\\\\/g,"\\").replace(/\\'/g,"'")};g.template=function(b,a){var c=g.templateSettings;b="var __p\x3d[],print\x3dfunction(){__p.push.apply(__p,arguments);};with(obj||{}){__p.push('"+b.replace(/\\/g, "\\\\").replace(/'/g,"\\'").replace(c.escape||D,function(b,a){return"',_.escape("+E(a)+"),'"}).replace(c.interpolate||D,function(b,a){return"',"+E(a)+",'"}).replace(c.evaluate||D,function(b,a){return"');"+E(a).replace(/[\r\n\t]/g," ")+";__p.push('"}).replace(/\r/g,"\\r").replace(/\n/g,"\\n").replace(/\t/g,"\\t")+"');}return __p.join('');";var d=new Function("obj","_",b);return a?d(a,g):function(b){return d.call(this,b,g)}};g.chain=function(b){return g(b).chain()};var y=function(b){this._wrapped=b}; g.prototype=y.prototype;var F=function(b,a){return a?g(b).chain():b},J=function(b,a){y.prototype[b]=function(){var b=f.call(arguments);k.call(b,this._wrapped);return F(a.apply(g,b),this._chain)}};g.mixin(g);u("pop push reverse shift sort splice unshift".split(" "),function(b){var a=d[b];y.prototype[b]=function(){var c=this._wrapped;a.apply(c,arguments);var d=c.length;"shift"!=b&&"splice"!=b||0!==d||delete c[0];return F(c,this._chain)}});u(["concat","join","slice"],function(b){var a=d[b];y.prototype[b]= function(){return F(a.apply(this._wrapped,arguments),this._chain)}});y.prototype.chain=function(){this._chain=!0;return this};y.prototype.value=function(){return this._wrapped}}).call(this);m.when("A","gb-udp-event-emitter").register("gb-udp-deal-dao",function(h,a){return a.extend({init:function(a){this._super();if(!a)throw Error("Cannot create a DealDAO object with undefined dealID");this.timeouts={startTimeout:null,endTimeout:null,endTimeoutDelayed:null,statusExpireTimeout:null,expireTimeout:null, pstatusExpire:null,pstatusExpiresSoon:null};this.checkingDealStatus=!1;this.lastPstatusExpireState="";this.dealID=a;this.loading=!0;this.customerID=null;this.expired=!1;this.parentItems=this.parentAsin=null;this.claimed=!1;this.itemType=this.dealType=null;this.dealState=Deal.stateToTemplateMap.Loading;this.offerListingID=this.impressionAsin=this.buyAsin=this.discussionBoardURL=this.legacyDealID=this.cacheExpiresDate=this.msToCacheExpires=null;this.detail={title:null,description:null,marketplaceID:null, imageAsin:null,score:null,secondaryImages:null,URL:null,buyBoxURL:null,displayPriority:null,isFeatured:null,marketingMessage:null,geoDisplayName:null,accessType:null,isPrimeOnly:null,isPrimeEarly:null,accessDurationInMs:null};this.pricingData={dealPriceHash:{isRange:null,max:{price:null,formattedPrice:null,currency:null},min:{price:null,formattedPrice:null,currency:null}},basisPriceHash:{isRange:null,max:{price:null,formattedPrice:null,currency:null},min:{price:null,formattedPrice:null,currency:null}}}; this.percentOff={isRange:null,max:null,min:null};this.status={dealState:null,currentlyUnavailable:!1,percentClaimed:null,percentSoldOut:null,lastUpdated:null,totalCouponsCount:null,msToStart:null,msToEnd:null,startDate:null,endDate:null,ended:null,msToCacheExpires:null,cacheExpiresDate:null,started:null,expired:null};this.isLimitedQuantity=null;this.teaser={teaserLine:null,teaserImage:null,teaserURL:null,teaserAsin:null};this.fastTrackMessage=this.swfContents=null;this.dealAsins=[];this.dealAsinsHash= {};this.auxiliaryData={isPrimeEligible:null,breaksMAP:null,merchantDetails:{merchantID:null,merchantName:null},reviewData:{averageRating:null,totalReviews:null,reviewsURL:null}};this.purchaseStatusWarningThreshold=6E5},validate:function(a){},setItemType:function(a){this.itemType=this.dealAsins&&1b.status.percentSoldOut)return!1}return!0},calculatePriceData:function(a){var b=Deal.Price.findMaxMinPrices(this,a);Deal.Price.isEmptyPriceObject(b)||(this.pricingData.basisPriceHash.max=b.maxBasisPrice,this.pricingData.basisPriceHash.min= b.minBasisPrice,Deal.Price.maxEqualMin(this.pricingData.basisPriceHash)?this.pricingData.basisPriceHash.isRange=!1:this.pricingData.basisPriceHash.isRange=!0,this.pricingData.dealPriceHash.max=b.maxDealPrice,this.pricingData.dealPriceHash.min=b.minDealPrice,Deal.Price.maxEqualMin(this.pricingData.dealPriceHash)?this.pricingData.dealPriceHash.isRange=!1:this.pricingData.dealPriceHash.isRange=!0);a&&(a.maxPercentOff&&(this.percentOff.max=parseInt(a.maxPercentOff)),a.minPercentOff&&(this.percentOff.min= parseInt(a.minPercentOff)),this.percentOff.isRange=this.percentOff.max===this.percentOff.min?!1:!0)},calculateAuxiliaryDataFromItem:function(){var a=Deal.findBackBoneDealAsin(this);if(a){if(null===this.auxiliaryData.isPrimeEligible||void 0===this.auxiliaryData.isPrimeEligible)this.auxiliaryData.isPrimeEligible=a.auxiliaryData.isPrimeEligible;if(null===this.auxiliaryData.breaksMAP||void 0===this.auxiliaryData.breaksMAP)this.auxiliaryData.breaksMAP=a.auxiliaryData.breaksMAP;if(null===this.auxiliaryData.merchantDetails|| void 0===this.auxiliaryData.merchantDetails)this.auxiliaryData.merchantDetails=a.auxiliaryData.merchantDetails;if(null===this.auxiliaryData.reviewData||void 0===this.auxiliaryData.reviewData)this.auxiliaryData.reviewData=a.auxiliaryData.reviewData}}})});m.when("A","gb-udp-event-emitter").register("gb-udp-deal-asin-dao",function(h,a){return a.extend({init:function(a){this._super();if(void 0===a||!a)throw Error("Cannot create a DealAsinDAO object with undefined asin");Deal.log("Created DealAsinDAO instance for: "+ a);this.ASIN=a;this.timeouts={};this.imageURL=this.basisKind=this.basisPriceFormatted=this.basisPrice=this.dealPriceFormatted=this.dealPrice=this.marketplaceID=this.parentDealDAO=this.dealID=null;this.isParent=!1;this.percentOff=this.percentOffBasisPrice=this.totalAvailable=null;this.status={state:null,itemState:null,expiresDate:null,offerServiceSoldOut:null,currentlyUnavailable:null,percentClaimed:null,percentSoldOut:null,lastUpdated:null,msToExpiry:null,totalCouponsCount:null};this.isCustomerClaimed= !1;this.waitListStatus={position:null,chance:null,timeToWait:null};this.offerListingID=this.variationData=null;this.auxiliaryData={isPrimeEligible:null,breaksMAP:null,merchantDetails:{merchantID:null,merchantName:null},reviewData:{averageRating:null,totalReviews:null,reviewsURL:null}};this.perCustomerAmount=this.offerID=this.isWaitlistable=this.isTimeLimited=this.isOneClickable=this.isParentItem=this.ingressUrl=this.egressUrl=null},validate:function(a){}})});m.when("A","gb-udp-deal-asin-dao","gb-udp-event-emitter").register("gb-deal-content-service-translation-helper", function(m,a,c){return c.extend({init:function(b){this._super()},validate:function(b){},populateFromGetDealMetadata:function(){},populateFromGetDeals:function(b,a){if(b&&a){b.loading=!1;b.legacyDeal||(b.legacyDeal=new Deal.Model.Deal(a.dealID));b.customerID=gbResources.getCustomerData("customerId");b.claimed=!1;b.dealID=a.dealID;b.legacyDealID=a.legacyDealID;b.parentAsin=null;b.dealType=a.type;if(a.parentItems){b.parentItems||(b.parentItems={});for(var c in a.parentItems)b.parentAsin||(b.parentAsin= c),b.parentItems[c]=a.parentItems[c]}b.isLimitedQuantity=!1;b.limitedQuantity=!1;a.quantity&&(a.quantity=parseInt(a.quantity,10));if(b.dealType==Deal.dealTypes.LD||a.quantity&&0c.lastUpdated)return;b.status.lastUpdated=c.lastUpdated}if(!(b.dealType=== Deal.dealTypes.LD&&b.status.cacheExpiresDate>e)){void 0!==c.totalCouponCount&&null!==c.totalCouponCount&&(b.status.totalCouponsCount=parseInt(c.totalCouponCount,10));if(void 0!==c.dealState&&null!==c.dealState){b.status.dealState=c.dealState;var f=Deal.stateToTemplateMap[Deal.dealStates[c.dealState]];void 0!==f&&null!==f&&(b.dealState=f)}void 0!==c.msToEnd&&null!==c.msToEnd&&(b.status.msToEnd=parseInt(c.msToEnd,10));void 0!==c.msToStart&&null!==c.msToStart&&(b.status.msToStart=parseInt(c.msToStart, 10),b.dealState===Deal.stateToTemplateMap.Upcoming&&0>=b.status.msToStart&&(b.dealState=Deal.stateToTemplateMap.ComingSoon));void 0!==c.msCacheTtl&&null!==c.msCacheTtl&&(b.status.msToCacheExpires=parseInt(c.msCacheTtl,10));void 0!==c.percentClaimed&&null!==c.percentClaimed&&(b.status.percentClaimed=parseInt(c.percentClaimed,10));for(var k in c.dealItemStatus)if(null===b.dealAsinsHash[k]||void 0===b.dealAsinsHash[k])f=new a(k),f.parentDealDAO=b,b.dealAsins.push(f),b.dealAsinsHash[k]=f;void 0!==c.dealItemStatus&& null!==c.dealItemStatus&&this.populateFromDealItemStatuses(b,c.dealItemStatus);this.initStatus(b,e);this.initAsinStatus(b);b.trigger("change",b);void 0!==b.legacyDeal&&null!==b.legacyDeal&&b.legacyDeal.load_status_from_deal_dao(b)}}},populateFromDealItemStatuses:function(b,a){if(void 0===b||null===b)Deal.log("Cannot populateFromDealItemStatuses for undefined/null deal obj.");else if(void 0===a||null===a)Deal.log("Cannot populateFomDealItemStatuses for undefined/null json obj.");else{var c,f;for(f in a)void 0!== b.dealAsinsHash[f]&&null!==b.dealAsinsHash[f]?(c=b.dealAsinsHash[f],this.populateFromDealItemStatus(c,a[f])):Deal.log("Cannot populate itemStatus on a non-existed item for imte: "+f)}},populateFromDealItemStatus:function(b,a){if(void 0===b||null===b)Deal.log("Cannot populateFromDealItemStatus for undefined/null dealAsin.");else if(void 0===a||null===a)Deal.log("Cannot populate DealItemStatus from undefined/null json obj.");else{if(void 0!==a.lastUpdated&&null!==a.lastUpdated){a.lastUpdated=parseInt(a.lastUpdated, 10);if(void 0!==b.status.lastUpdated&&null!==b.status.lastUpdated&&b.status.lastUpdated>a.lastUpdated)return;b.status.lastUpdated=a.lastUpdated}void 0!==a.totalCouponCount&&null!==a.totalCouponCount&&(b.status.totalCouponsCount=parseInt(a.totalCouponCount,10));void 0!==a.customerState&&null!==a.customerState&&(b.status.state=Deal.customerStates[a.customerState]);void 0!==a.itemState&&null!==a.itemState&&(b.status.itemState=a.itemState,Deal.itemStateToPurchaseStateMap[b.status.itemState]==Deal.dealStateEnum.SoldOut&& (b.status.percentSoldOut=100));void 0!==a.msCacheTtl&&null!==a.msCacheTtl&&(b.status.msToCacheExpires=parseInt(a.msCacheTtl,10));void 0!==a.msToCustomerStateExpiry&&null!==a.msToCustomerStateExpiry&&(b.status.msToExpiry=parseInt(a.msToCustomerStateExpiry,10));void 0!==a.percentClaimed&&null!==a.percentClaimed&&(b.status.percentClaimed=parseInt(a.percentClaimed,10));void 0!==a.waitlistChance&&null!==a.waitlistChance&&(b.waitListStatus.chance=a.waitlistChance);void 0!==a.waitlistPosition&&null!==a.waitlistPosition&& (b.waitListStatus.position=parseInt(a.waitlistPosition,10));b.isCustomerClaimed=Deal.customerStates[a.customerState]===Deal.claimedStr?!0:!1}},initStatus:function(a,c){a.status.cacheExpiresDate=new Date(c.getTime()+parseInt(a.status.msToCacheExpires,10));a.status.expired=!1;a.status.startDate=new Date(c.getTime()+parseInt(a.status.msToStart,10));a.status.started=0>=a.status.msToStart;a.status.endDate=new Date(c.getTime()+parseInt(a.status.msToEnd,10));a.status.ended=0>=a.status.msToEnd;a.claimed&& (a.claimed="1"==a.claimed);a.timeouts.startTimeout&&(h.clearTimeout(a.timeouts.startTimeout),Deal.log("DealContentServiceTranslationHelper._init_status: Clearing out deal.timeouts.startTimeout for deal: "+a.dealID));a.status.started||(a.timeouts.startTimeout=m.delay(function(){if(a.dealType===Deal.dealTypes.LD&&Deal.hasPricingDetails(a))a.status.started=!0,a.status.msToStart=0,a.status.dealState=Deal.itemStates.Available,a.dealState=Deal.stateToTemplateMap[Deal.dealStates.AVAILABLE],_.each(a.dealAsinsHash, function(a,b,c){a.status.itemState=Deal.itemStates.Available}),a.trigger("change",a);else{var c=a.dealID;Deal.controller.dealServiceClients.DealContentService.dealsWithDetails[c]=!1;a.trigger("change",Deal.controller.getDeal("DummyDealID"));Deal.controller.dealServiceClients.DealContentService.addToGetDealsCache(c);Deal.log("Triggering change signal on deal: "+a.dealID+" from deal.timeouts.startTimeout Trigger.")}},a.status.startDate.getTime()-(new Date).getTime()),Deal.log("DealContentServiceTranslationHelper._init_status: Setting deal.timeouts.startTimeout for deal: "+ a.dealID));a.timeouts.endTimeout&&(h.clearTimeout(a.timeouts.endTimeout),Deal.log("DealContentServiceTranslationHelper._init_status: Clearing out deal.timeouts.endTimeout for deal: "+a.dealID));a.status.ended||(c=a.status.endDate.getTime()-(new Date).getTime(),a.timeouts.endTimeoutDelayed&&h.clearTimeout(a.timeouts.endTimeoutDelayed),a.timeouts.endTimeoutDelayed=Deal.setSafeTimeout(function(){a.timeouts.endTimeout=m.delay(function(){a.status.ended=!0;a.trigger("change",a);Deal.log("Triggering change signal on deal: "+ a.dealID+" from deal.timeouts.endTimeout Trigger.")},a.status.endDate.getTime()-(new Date).getTime())},c),Deal.log("DealContentServiceTranslationHelper._init_status: Setting deal.timeouts.endTimeOut for deal: "+a.dealID));a.timeouts.earlyAccessTimeOut&&h.clearTimeout(a.timeouts.earlyAccessTimeOut);Deal.isDealInEarlyAccessWindow(a)&&(a.timeouts.earlyAccessTimeOut=m.delay(function(){a.status.msToStart=-a.detail.accessDurationInMs;a.trigger("change",a)},a.status.startDate.getTime()+a.detail.accessDurationInMs- (new Date).getTime()));a.timeouts.statusExpireTimeout&&(h.clearTimeout(a.timeouts.statusExpireTimeout),Deal.log("DealContentServiceTranslationHelper._init_status: Clearing out deal.timeouts.statusExpireTimeout for deal: "+a.dealID));c=a.status.cacheExpiresDate.getTime()-(new Date).getTime();Deal.checkIfDealExpired(a)&&(new Deal.PurchaseStatusGatherer(a)).hasTimeSensitiveState()&&(c=12E3);a.timeouts.statusExpireTimeout=m.delay(function(){if(a.dealType!==Deal.dealTypes.LD||a.status.started||Deal.hasPricingDetails(a))a.status.expired= !0,a.trigger("status_expire",a),Deal.log("Triggering status_expire signal on deal: "+a.dealID+" from deal.timeouts.statusExpireTimeout Trigger.");else{var c=Deal.controller.dealServiceClients.DealContentService;c.dealsWithDetails[a.dealID]=!1;c.addToGetDealsCache(a.dealID)}},c);Deal.log("DealContentServiceTranslationHelper._init_status: Setting deal.timeouts.statusExpireTimeout for deal: "+a.dealID+" for timeout: "+(a.status.cacheExpiresDate.getTime()-(new Date).getTime()));Deal.log("DealContentServiceTranslationHelper.initStatus completed.")}, initAsinStatus:function(a){if(void 0===a||null===a)Deal.log("Cannot operate on undefined/null deal object.");else if(void 0===a.dealType||null===a.dealType)Deal.log("Cannot operate on undefined/null dealType.");else if(a.dealType!==Deal.dealTypes.LD)Deal.log("Returning initAsinStatus as NO-OP for non-LD's.");else if(a.dealAsinsHash){a.timeouts.pstatusExpiresSoon||(a.timeouts.pstatusExpiresSoon={});a.timeouts.pstatusExpire||(a.timeouts.pstatusExpire={});_.each(a.dealAsins,function(a){Deal.dealStates[a.status.itemState]=== Deal.waitlistFullStr&&(a.status.currentlyUnavailable=!0)});for(var c=Deal.filterAsinsHashByState(a.dealAsinsHash,[Deal.inCartStr,Deal.expiredStr,Deal.waitInLineStr,Deal.pendingAtcStr]),e=new Date,f=0;fe&&(e=0);var n=""+k.ASIN;0l.maxRetries&&(d._execErrorCallback({messagePrefix:d.response_error_handling.retries_timed_out_message,url:a.url,errorResponse:r,error:q}),w=!1)}else v=n*(1+Math.pow(2,f++)* Math.random()),v+(new Date).getTime()-e.getTime()>d.timeout&&(d._execErrorCallback({messagePrefix:d.response_error_handling.retries_timed_out_message,url:a.url,errorResponse:r,error:q}),w=!1);w&&(Deal.log("Retrying after "+v+"ms"),"function"===typeof k&&k(),h.delay(m,v))},h.$.ajax(a)):q(Error("continue_requests is false. No more requests should be made "+a.url))};m()},next_id:100,getRetryInterval:function(a,b){return Math.pow(2,a-1)*(b.baseRetryInterval+Deal.getRandomNumber(-1E3,1E3))}})});m.when("A", "gb-deals-interface","gb-deal-content-service-translation-helper").register("gb-deal-redemption-service",function(h,a,c){return a.extend({baseRetryIntervalMs:1E4,translationHelper:null,clientId:"goldbox",apiConfig:{maxRetries:1,baseRetryInterval:4E3,endPoint:"/gp/deal/ajax/v2/claimDeal.html"},init:function(a){this._super();this.translationHelper=new c},claimDeal:function(a,c,e,f,k,l,n){var q=this.apiConfig.endPoint,h;gbResources&&"function"===typeof gbResources.getCustomerData&&gbResources.getCustomerData("csrfToken")&& (h=function(a){a.setRequestHeader("X-CSRFToken",gbResources.getCustomerData("csrfToken"))});q+="/ref\x3d"+e+"?dealId\x3d"+a+"\x26itemId\x3d"+c+"\x26quantity\x3d"+f+"\x26clientId\x3d"+this.clientId;this.call(q,{},k,l,this.baseRetryIntervalMs,{apiName:Deal.apiName.CLAIM_DEAL,clientId:this.clientId},n,h)},call:function(a,c,e,f,k,l,n,q){a={success:function(a,b){e(a,b)},error:f,retry:n,url:a,type:"POST",data:JSON.stringify(c),dataType:"json"};q&&(a.beforeSend=q);a.apiConfig=this.apiConfig;this.ajax_with_retries(a, l)}})});m.when("A","jQuery","gb-udp-event-emitter").register("gb-mnss-service",function(h,a,c){return c.extend({base_retry_interval:2E4,continue_requests:!0,customer_id:"",session_id:null,timeout:3E5,init:function(a){this._super();this.customer_id=gbResources.getCustomerData("customerId");this.session_id=gbResources.getCustomerData("sessionId")},ajax_with_retries:function(b){var c=this,e=new Date,f=0,k=b.retryInterval||this.base_retry_interval||6E4;delete b.retryInterval;var l=b.error;delete b.error; var n=function(){c.continue_requests?(-1==b.url.indexOf("?")?b.url=b.url+"?nocache\x3d"+(new Date).getTime():b.url=b.url+"\x26nocache\x3d"+(new Date).getTime(),b.error=function(a){var b=k*(1+Math.pow(2,f++)*Math.random());b+(new Date).getTime()-e.getTime()>c.timeout?l(Error("Retries timed out"+JSON.stringify(a))):(Deal.log("retrying after "+b+"ms"),h.delay(n,b))},a.ajax(b)):l(Error("continue_requests is false: no more requests should be made."))};n()},call:function(a,c,e,f,k){a={success:e,error:f, url:a,type:"POST",data:JSON.stringify(c),dataType:"json"};void 0!==k&&(a.retryInterval=k);this.ajax_with_retries(a)},register_for_notifications:function(a,c,e){this.call("/gp/deal/ajax/registerForNotifications.html/ref\x3dgb_mshop?customer\x3d"+this.customer_id+"\x26sessionId\x3d"+this.session_id+"\x26token\x3d"+a.pushToken+"\x26application\x3d"+a.appID+"\x26protocol\x3d"+a.protocol,{},c,e,this.base_retry_interval)}})});m.when("A","jQuery","gb-deals-interface","gb-deal-content-service-translation-helper", "gb-dp-csm").register("gb-deal-content-service",function(p,a,c,b,d){return c.extend({base_retry_interval:6E4,client_id:"goldbox",continue_requests:!0,customer_id:null,dealsPerPage:null,marketplace_id:null,page:1,session_id:null,timeout:3E5,translationHelper:null,getDealsMaxJitter:Deal.constants.GET_DEALS_MAX_JITTER,shouldPublishGDSCompletion:!0,widgetMetadataCache:{},selectDealsRequestArgs:{},uniqueSelectDealsRequestArgs:[],onGoingSelectDealsRequest:{},widgetIdToArgs:{},firstGetDeals:{},dealsWithDetails:{}, dealStateFilter:{available:["AVAILABLE"],missed:["EXPIRED","SOLDOUT"],expired:["EXPIRED"],upcoming:["UPCOMING"],soldout:["SOLDOUT"]},getDealsCache:[],init:function(a){this._super();this.customer_id=gbResources.getCustomerData("customerId");this.marketplace_id=gbResources.getCustomerData("marketplaceId");this.session_id=gbResources.getCustomerData("sessionId");a&&a.client_id&&(this.client_id=a.client_id);this.translationHelper=new b},addToGetDealsCache:function(a){var b=this;null===a||void 0===a?Deal.log("addToGetDealsCache called with null/undefined dealID"): _.contains(b.getDealsCache,a)||(b.getDealsCache.push(a),1===b.getDealsCache.length&&p.delay(function(){var a=[];_.each(b.getDealsCache,function(c){b.dealsWithDetails[c]||a.push(c)});b.getDealsCache=[];a.length&&b.get_Deals(a,Deal.controller,!1)},Math.floor(Math.random()*b.getDealsMaxJitter*1E3)+500))},getMetadataCacheWidgets:function(){return _.map(_.keys(this.widgetMetadataCache),function(a){return parseInt(a,10)}).sort()},processWidgetMetadataCache:function(a){for(var b=this.getMetadataCacheWidgets(), c=0;c=l*(h-1)&&b.listOfDeals[c].push(q))}b.trigger("startGetDealStatusesAdhoc",a);b.off("startGetDealsConnectionWiring"+c);b.trigger("startCellChangeAndStatusConnectionWiring"+c,b.listOfDeals[c])},t= b.getWidgetParams(c);void 0!==m&&null!==m&&a.extend(!0,t,m);void 0===this.selectDealsRequestArgs[c]&&(this.selectDealsRequestArgs[c]=t);m=this.requestArgsExist(t);m||(this.selectDealsRequestArgs[c]=t,this.uniqueSelectDealsRequestArgs.push(t));!1!==this.firstGetDeals[c]||m||(this.firstGetDeals[c]=!0);if(!0===this.firstGetDeals[c])if(this.firstGetDeals[c]=!1,m&&this.onGoingSelectDealsRequestForArgs(t)&&void 0===this.onGoingSelectDealsRequest[c]){if(this.onGoingSelectDealsRequest[c]=!0,d=function(a){delete p.onGoingSelectDealsRequest[c]; b.trigger("selectdeals_change"+c,a)},t=this.currentWidgetIdForArgs(t),void 0!==t||null!==t)b.on("selectdeals_change"+c,w),b.on("startGetDealsConnectionWiring"+c,v),b.on("selectdeals_change"+t,d)}else b.on("selectdeals_change"+c,w),b.on("startGetDealsConnectionWiring"+c,v),this.onGoingSelectDealsRequest[c]=!0,this.recordArgs(c,t),this.select_deals(c,l,t,b);else b.metadata.checkIfStatusFilterSeen(c,d)&&void 0===this.onGoingSelectDealsRequest[c]&&(b.on("startGetDealsConnectionWiring"+c,v),b.trigger("startGetDealsConnectionWiring"+ c))}},get_deal_statuses:function(a,b){var c=d.getAjaxMetricLogger("dcs-get-deal-status").recordStart(),l=this,n=l.get_getDealStatuses_request_data(a);l.call("/xa/dealcontent/v2/GetDealStatus",n,function(d,n){c.recordComplete(n);n={};var h,m;for(h in d.dealStatus)m=d.dealStatus[h],a[h][0](m),n[h]=!0;var p=l._deal_ids_to_item_ids_from_callbacks(a);for(m=0;m=_.keys(d.dealAsinsHash).length){var l=Deal.findBackBoneDealAsin(d);void 0!==l&&null!==l&&void 0!==l.status&&null!==l.status&&void 0!==l.status.state&&null!==l.status.state&&(d.lastPstatusExpireState=l.status.state,!Deal.checkIfDealExpired(d)||l.status.state!==Deal.inCartStr&&l.status.state!==Deal.pendingAtcStr||(l.status.state="Expired",d.trigger("change",d)));d.checkingDealStatusTimeout=m.delay(function(){d.lastPstatusExpireState= "";delete d.checkingDealStatusTimeout},4E4)}d.trigger("status_expire",d);a.trigger("pstatus_expire"+c,{cell:b,deal:d,expiring_asin:e})};d.on("pstatus_expire",e);this.connections[c].push({signalName:"pstatus_expire",scope:d,callBackValue:e})},connectDealStatusExpire:function(a,c,b){if(!Deal.watcher.isDealBeingWatched(b.dealID,c)){var d=function(b){var d=a.dealServiceInstance[c].get_deal_status(b.dealID,function(d){b.off("cancelGetDealStatusRequest");a.dealServiceInstance[c].translationHelper.populateFromGetDealStatus(b, d)},function(a){Deal.log("Error getting status: "+a+" stack: "+a.stack)},a);b.on("cancelGetDealStatusRequest",function(){d.cancel();b.off("cancelGetDealStatusRequest")});var k=a.dealServiceInstance[c].get_deal_asin_status2(b.dealID,function(d){b.off("cancelGetDealAsinStatusRequest");a.dealServiceInstance[c].translationHelper.populateFromGetDealAsinStatus(b,d);b.trigger("change",b)},function(a){Deal.log("Error with GetDealAsinStatus("+b.dealID+"): "+a)});b.on("cancelGetDealAsinStatusRequest",function(){k.cancel(); b.off("cancelGetDealAsinStatusRequest")})};b.on("status_expire",d);this.dealObjectToCallBacks.push({signalName:"status_expire",scope:b,callBackValue:d})}!b.status.expired||b.expired||b.loading||b.trigger("status_expire",b)},connectSignal:function(a,c,b,d,e){if(void 0===a||null===a||void 0===c||null===c||void 0===b||null===b||void 0===d||null===d||void 0===e||null===e)throw Error("Please provide a valid scope, signalName, widgetID, functionName");if(void 0===this.signals[c])throw Error("Please provide a valid scope, signalName, widgetID, functionName"); if(void 0===this.signals[c][b])throw Error("Please provide a valid scope, signalName, widgetID, functionName");var f=this.nextSignalID,k;void 0!==e&&(k=e[d],e.on(c+b,k),d=function(a){e.trigger(c+b,a)});a.on(c+b,d);this.signals[c][b][f]={callBackValue:d,scope:e,scopeCallBackValue:k};this.nextSignalID++;return{widgetID:b,id:f}},disconnectCurrentPageSignals:function(a,c){_.each(a.dealsInCurrentView[c],function(a){Deal.watcher.unwatchDeal(a.dealID,c)});_.each(a.dealsInNextView[c],function(a){Deal.watcher.unwatchDeal(a.dealID, c)});a.dealsInCurrentView[c]=[];a.dealsInNextView[c]=[];for(a=0;aa.status.msToEnd&&(c.span&&0a.status.msToEnd&&(c.span&&0c.status.percentClaimed?(Deal.isDealInEarlyAccessWindow(a)||(this.viewSpanIds.primeEarlyAccessMessage.addClass("a-hidden"),this.viewSpanIds.appEarlyAccessMessage.addClass("a-hidden"),a.detail.accessType===Deal.accessTypeEnum.APP_ONLY_LD?gbResources.getCustomerData("isApp")?this.hideSpansExcept(["spanShowProgress", "spanDealTimerContainer","spanATC","spanShowQuantity"]):this.hideSpansExcept(["spanShowProgress","appOnlyAccessMessage","appDownloadButton","spanShowQuantity"]):Deal.isPrimeOnlyDeal(a)?this.hideSpansExcept(["spanATC","primeOnlyAccessMessage","spanDealTimerContainer","spanShowProgress","spanShowQuantity"]):this.hideSpansExcept(["spanATC","spanDealTimerContainer","spanShowProgress","spanShowQuantity"]),this.updateHeaderMessage()),Deal.isDealInEarlyAccessWindow(a)?a.detail.accessType!==Deal.accessTypeEnum.PRIME_EARLY_ACCESS|| gbResources.getCustomerData("hasEarlyAccessBenefit")?a.detail.accessType===Deal.accessTypeEnum.APP_EARLY_ACCESS&&(gbResources.getCustomerData("isApp")?this.hideSpansExcept(["spanShowProgress","spanDealTimerContainer","spanATC","spanShowQuantity"]):this.hideSpansExcept(["spanShowProgress","spanDealTimerContainer","appEarlyAccessMessage","appDownloadButton","spanShowQuantity"])):this.hideSpansExcept(["primeEarlyAccessMessage","spanShowProgress","spanShowQuantity","spanDealTimerContainer","primeEarlyAccessTryPrimeButton"]): Deal.isPrimeOnlyDeal(a)&&!gbResources.getCustomerData("hasExclusiveAccessBenefit")?this.hideSpansExcept(["primeOnlyAccessMessage","spanShowProgress","spanShowQuantity","spanDealTimerContainer","primeEarlyAccessTryPrimeButton"]):a.detail.accessType===Deal.accessTypeEnum.APP_ONLY_LD&&(gbResources.getCustomerData("isApp")?this.hideSpansExcept(["spanShowProgress","spanDealTimerContainer","spanATC","spanShowQuantity"]):this.hideSpansExcept(["spanShowProgress","appOnlyAccessMessage","appDownloadButton", "spanShowQuantity"]))):Deal.log("UDPWidgetView: unhandled case in renderLightningDealBuybox"),this.updateDealStatus(a))}},hideSpansExcept:function(a){var c,e;for(e in this.viewSpanIds){c=!1;for(var f in a)if(a[f]===e){c=!0;this.viewSpanIds[e].removeClass("a-hidden");break}!1===c&&this.viewSpanIds[e].addClass("a-hidden")}},updateHeaderMessage:function(a){h.$("#gbld_header_message").children().addClass("a-hidden");void 0!==a&&null!==a&&this.viewHeaderMsgSpanIds[a].removeClass("a-hidden")},updateDealStatus:function(a){var c, e=a.dealAsinsHash[this.asin],f=null,f=null;if(e.status.state===Deal.inCartStr)c=(new Date).getTime(),f=new Date(c+parseInt(e.status.msToExpiry)),f=Deal.UDPTimer(f,1,a),f.span=this.viewTimerSpanIds.spanCheckoutTimer,this.timers.push(f);else if(e.status.state===Deal.pendingAtcStr)c=(new Date).getTime(),f=new Date(c+parseInt(e.status.msToExpiry)),f=Deal.UDPTimer(f,1,a),f.span=this.viewTimerSpanIds.spanPendingATCTimer,this.timers.push(f);else if(a.status.endDate){c=this.viewTimerSpanIds.spanDealTimer; var k=this.viewTimerSpanIds&&c&&0a.status.msToEnd&&k&&f.span.addClass("a-color-success");this.timers.push(f)}(c=e.status.percentClaimed)&&0<=parseFloat(c)&&100>=parseFloat(c)&&(c=Math.round(c),k=this.viewTimerSpanIds.spanDealStsProgBar.find("#progBarBase"),f=this.viewTimerSpanIds.spanDealStsProgBar.find("#progBarTick"), k.css("width",c+"%"),f.css("width",c+"%"),this.viewTimerSpanIds.spanDealStsPercent.html(c+"%"),this.viewTimerSpanIds.spanDealStsAvailMsg.html(c+"%"),89>=c?(this.viewTimerSpanIds.spanDealStsPercent.removeClass("a-color-error").removeClass("a-color-success").addClass("a-color-base"),this.viewTimerSpanIds.spanDealStsClaimedText.removeClass("a-color-error").removeClass("a-color-success").addClass("a-color-base")):99>=c?(this.viewTimerSpanIds.spanDealStsPercent.removeClass("a-color-base").removeClass("a-color-success").addClass("a-color-success"), this.viewTimerSpanIds.spanDealStsClaimedText.removeClass("a-color-base").removeClass("a-color-success").addClass("a-color-success")):(this.viewTimerSpanIds.spanDealStsPercent.removeClass("a-color-base").removeClass("a-color-success").addClass("a-color-error"),this.viewTimerSpanIds.spanDealStsClaimedText.removeClass("a-color-base").removeClass("a-color-success").addClass("a-color-error")),e.offerServiceSoldOut||100<=e.status.percentSoldOut||Deal.checkIfDealExpired(a))&&(k.removeClass("progbar"),f.removeClass("progbartick"), k.addClass("progbarmissed"),f.addClass("progbartickmissed"));m.when("A").execute(function(c){var d=c.$;if(void 0!==c.state("offerBadges")){var e=c.state("offerBadges").displayOfferBadge;c=c.state("offerBadges").lightningDealString;!e||Deal.checkIfDealExpired(a)||Deal.isDealInEarlyAccessWindow(a)||Deal.isPrimeOnlyDeal(a)||0c;c++)d.onInit("jumpstart-"+c,function(a){1===a.getAttr("totalPages")? e(".jumpstart-carousel-pagination-buttons").css("visibility","hidden"):e(".jumpstart-carousel-pagination-buttons").css("visibility","visible")});return{updatePaginationForCarousel:function(a){1===d.getCarouselByName(a).getAttr("totalPages")?e(".jumpstart-carousel-pagination-buttons").css("visibility","hidden"):e(".jumpstart-carousel-pagination-buttons").css("visibility","visible")},initializeCarousel:function(){d.createAll();d.initializeAll()}}});f.when("A","ready").register("get-started-meter-animation", function(b){b.on("pageStateReady",function(d){b.$(".animationMeterBar > .a-meter-bar").delay(400).animate({width:d.percent+"%"},600)})});f.when("A","baby-reg-js-update","ready").register("get-started-declarative-actions",function(b,d){b.declarative("start-jumpstart-action","click",function(e){var c=b.$;e=e.data;var a=b.state("baby-reg-util");e={isSable:1,completionStatus:1,update:"updateJumpstartCompletionStatus",registryId:e!==g?e.registryId:null,sid:a!==g?a.sid:null};c("#getStartedError").hasClass("js-hidden")|| c("#getStartedError").addClass("js-hidden");d.update("updateJumpstartCompletionStatus",e,function(a){a&&1===a.hasUpdated?(c("#js-widget-box").removeClass("js-hidden"),c("#getStartedBox").addClass("js-hidden")):c("#getStartedError").removeClass("js-hidden")})})});f.when("A").register("baby-reg-js-update",function(b){var d=b.$;return{update:function(e,c,a){e=d.extend({},{ref:"baby_reg_js_update_"+e,update:e,forceAjax:1},c);b.post("/gp/baby/api/update.html/ref="+e.ref,{params:e,success:function(b){a(b)}, failure:function(){a({ok:0})}})}}});f.when("A","a-popover","baby-reg-js-update","jumpstart-carousel","ready").register("jumpstart-mark-complete-actions",function(b,d,e,c){var a=b.$,f=!0,q=0,k=[],l=!1,p={},r=function(b,h){var c=a("#mark_complete_modal_item_"+b),d=a("#checkmarkBox_"+b),e=a("#checkmark-gray_"+b),g=a("#checkmark-orange_"+b);c.removeClass("item-mark-modal-gray");c.addClass("item-mark-modal-orange");d.removeClass("js-hidden");e.removeClass("js-hidden");g.addClass("js-hidden"); 1!==h&&(d.removeClass("checkmark-box-gray"),d.addClass("checkmark-box-orange"),e.addClass("js-hidden"),g.removeClass("js-hidden"))},t=function(b,h){var c=a("#mark_complete_modal_item_"+b),d=a("#checkmarkBox_"+b),e=a("#checkmark-gray_"+b),g=a("#checkmark-orange_"+b);e.removeClass("js-hidden");g.addClass("js-hidden");d.removeClass("checkmark-box-orange");1===h&&(c.addClass("item-mark-modal-gray"),c.removeClass("item-mark-modal-orange"),e.addClass("js-hidden"),g.addClass("js-hidden"),d.addClass("js-hidden")); d.addClass("checkmark-box-gray")},u=function(b){if(!1===l){var h=b.$currentTarget.closest(".a-popover");b=h.find(a("input[name=markedItemNumber]")).val();h=h.find(a("input[name=markedItems]")).val();q=b?b:0;b=h.substring(1,h.length-1);0a?"0"+a:a)+":"+(10>b?"0"+b:b)}function d(b,c){a&&a.count&&(a.count(b,(a.count(b)||0)+(c||1)),g&&a.count(b+"-"+g,(a.count(b)||0)+(c||1)))}var c=[],a=e.ue,b=null,f=null,g=null;return{init:function(l){if(l&&l.flashPlayerUrl&&l.container){var e=h(l.container),m=l.pauseCallback,u=l.playCallback,w,x;e.each(function(){var k=h(this);if("undefined"!==typeof k){var e=k.find(".audioPlaySample"),y=k.find(".audioPlaying"),z=k.find(".audioPaused"), A=k.find(".audioLoading"),r=new q;c.push(r);var t={},C=k.prev();t.audioSrc=C.data("audiosource");t.audioId=C.data("audioid");t.asin=C.data("asin");g=C.data("layoutweblab");t.flashPlayerUrl=l.flashPlayerUrl;t.audioControllerId=k;t.bindEventsCallback=function(c){c.bind("audioEnded",function(){z.hide();y.hide();e.show();A.hide();l.showPopover&&n.remove(k);d("adbl-smpl-play-ended");a&&a.tag&&a.tag("FinishedAudibleSample");w&&(b=null,clearInterval(w));x&&clearInterval(x);if("T1"===g||"T2"===g){var c=v(0); h(".audible-sample-container .time-remaining_text").html(c)}});c.bind("audioPlaying",function(){z.hide();e.hide();y.show();A.hide();if(l.showPopover){var b=l.popoverOptions;k&&b&&b.inlineContent&&(b.inlineContent=b.inlineContent.replace(/\/dp\/[a-zA-Z0-9]*\//g,"/dp/"+k.data("asin")+"/"),(b=n.create(k,b))&&b.show())}d("adbl-smpl-play");a&&a.tag&&a.tag("PlayedAudibleSample");w=setInterval(p,5E3);f=this;if("T1"===g||"T2"===g)B(),x=setInterval(B,1E3)});c.bind("audioPaused",function(){y.hide();e.hide(); z.show();A.hide();l.showPopover&&n.remove(k);d("adbl-smpl-pause");w&&(b=null,clearInterval(w));x&&clearInterval(x)});c.bind("audioLoad",function(){y.hide();e.hide();z.hide();A.show();l.showPopover&&n.remove(k);d("adbl-smpl-audio-loaded")})};r.init(t);r&&r.isPlayerAvailable&&(y.hide(),z.hide(),A.hide(),e.show(),k.removeClass("a-hidden"),k.children().click(function(){r.player.isPlaying?(r.pause(),"undefined"!==typeof m&&m()):(r.play(),"undefined"!==typeof u&&u())}))}})}},pause:function(){c.forEach(function(a){a.player.isPlaying&& a.pause()})}}})}); /* ******** */ (function(v){var y=window.AmazonUIPageJS||window.P,C=y._namespace||y.attributeErrors,p=C?C("SWFObject_AUIBuild"):y;p.guardFatal?p.guardFatal(v)(p,window):p.execute(function(){v(p,window)})})(function(v,y,C){v.register("SWFObject",function(){var p=function(){function z(){if(!w){try{var a=d.getElementsByTagName("body")[0].appendChild(d.createElement("span"));a.parentNode.removeChild(a)}catch(b){return}w=!0;for(var a=D.length,c=0;cf){f++;setTimeout(arguments.callee,10);return}a.removeChild(b);c=null;I()})()}else I()}function I(){var a=t.length;if(0e.wk)if(t[b].expressInstall&&J()){g={};g.data=t[b].expressInstall;g.width=d.getAttribute("width")||"0";g.height= d.getAttribute("height")||"0";d.getAttribute("class")&&(g.styleclass=d.getAttribute("class"));d.getAttribute("align")&&(g.align=d.getAttribute("align"));for(var h={},d=d.getElementsByTagName("param"),k=d.length,l=0;le.wk)}function K(a,b,c,f){F=!0;M=f||null;R={success:!1,id:c};var g=m(c);if(g){"OBJECT"==g.nodeName?(B=N(g),G=null):(B=g,G=c);a.id="SWFObjectExprInst";if("undefined"==typeof a.width||!/%$/.test(a.width)&&310>parseInt(a.width,10))a.width="310";if("undefined"==typeof a.height||!/%$/.test(a.height)&&137>parseInt(a.height, 10))a.height="137";d.title=d.title.slice(0,47)+" - Flash Player Installation";f=e.ie&&e.win?"ActiveX":"PlugIn";f="MMredirectURL="+n.location.toString().replace(/&/g,"%26")+"&MMplayerType="+f+"&MMdoctitle="+d.title;b.flashvars="undefined"!=typeof b.flashvars?b.flashvars+("&"+f):f;e.ie&&e.win&&4!=g.readyState&&(f=d.createElement("div"),c+="SWFObjectNew",f.setAttribute("id",c),g.parentNode.insertBefore(f,g),g.style.display="none",function(){4==g.readyState?g.parentNode.removeChild(g):setTimeout(arguments.callee, 10)}());O(a,b,c)}}function Z(a){if(e.ie&&e.win&&4!=a.readyState){var b=d.createElement("div");a.parentNode.insertBefore(b,a);b.parentNode.replaceChild(N(a),b);a.style.display="none";(function(){4==a.readyState?a.parentNode.removeChild(a):setTimeout(arguments.callee,10)})()}else a.parentNode.replaceChild(N(a),a)}function N(a){var b=d.createElement("div");if(e.win&&e.ie)b.innerHTML=a.innerHTML;else if(a=a.getElementsByTagName("object")[0])if(a=a.childNodes)for(var c=a.length,f=0;fe.wk)return f;if(g)if("undefined"==typeof a.id&&(a.id=c),e.ie&&e.win){var q="",h;for(h in a)a[h]!=Object.prototype[h]&&("data"==h.toLowerCase()?b.movie=a[h]:"styleclass"==h.toLowerCase()?q+=' class="'+a[h]+'"':"classid"!=h.toLowerCase()&&(q+=" "+h+'="'+a[h]+'"'));h="";for(var k in b)b[k]!=Object.prototype[k]&&(h+='');g.outerHTML='"+h+"";H[H.length]=a.id;f=m(a.id)}else{k=d.createElement("object");k.setAttribute("type","application/x-shockwave-flash");for(var l in a)a[l]!=Object.prototype[l]&&("styleclass"==l.toLowerCase()?k.setAttribute("class",a[l]):"classid"!=l.toLowerCase()&&k.setAttribute(l,a[l]));for(q in b)b[q]!=Object.prototype[q]&&"movie"!=q.toLowerCase()&&(a=k,h=q,l=b[q],c=d.createElement("param"),c.setAttribute("name",h),c.setAttribute("value",l),a.appendChild(c));g.parentNode.replaceChild(k,g);f=k}return f} function S(a){var b=m(a);b&&"OBJECT"==b.nodeName&&(e.ie&&e.win?(b.style.display="none",function(){if(4==b.readyState){var c=m(a);if(c){for(var f in c)"function"==typeof c[f]&&(c[f]=null);c.parentNode.removeChild(c)}}else setTimeout(arguments.callee,10)}()):b.parentNode.removeChild(b))}function m(a){var b=null;try{b=d.getElementById(a)}catch(c){}return b}function X(a,b,c){a.attachEvent(b,c);A[A.length]=[a,b,c]}function E(a){var b=e.pv;a=a.split(".");a[0]=parseInt(a[0],10);a[1]=parseInt(a[1],10)||0; a[2]=parseInt(a[2],10)||0;return b[0]>a[0]||b[0]==a[0]&&b[1]>a[1]||b[0]==a[0]&&b[1]==a[1]&&b[2]>=a[2]?!0:!1}function T(a,b,c,f){if(!e.ie||!e.mac){var g=d.getElementsByTagName("head")[0];g&&(c=c&&"string"==typeof c?c:"screen",f&&(P=r=null),r&&P==c||(f=d.createElement("style"),f.setAttribute("type","text/css"),f.setAttribute("media",c),r=g.appendChild(f),e.ie&&e.win&&"undefined"!=typeof d.styleSheets&&0\.;]/.exec(a)&&"undefined"!=typeof encodeURIComponent?encodeURIComponent(a):a}var n=y,d=document,u=navigator,W=!1,D=[function(){W?Y():I()}],t=[],H=[],A=[],B,G,M,R,w=!1,F=!1,r,P,U=!0,e=function(){var a="undefined"!=typeof d.getElementById&&"undefined"!=typeof d.getElementsByTagName&& "undefined"!=typeof d.createElement,b=u.userAgent.toLowerCase(),c=u.platform.toLowerCase(),f=c?/win/.test(c):/win/.test(b),c=c?/mac/.test(c):/mac/.test(b),b=/webkit/.test(b)?parseFloat(b.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):!1,g=!+"\v1",e=[0,0,0],h=null;if("undefined"!=typeof u.plugins&&"object"==typeof u.plugins["Shockwave Flash"])!(h=u.plugins["Shockwave Flash"].description)||"undefined"!=typeof u.mimeTypes&&u.mimeTypes["application/x-shockwave-flash"]&&!u.mimeTypes["application/x-shockwave-flash"].enabledPlugin|| (W=!0,g=!1,h=h.replace(/^.*\s+(\S+\s+\S+$)/,"$1"),e[0]=parseInt(h.replace(/^(.*)\..*$/,"$1"),10),e[1]=parseInt(h.replace(/^.*\.(.*)\s.*$/,"$1"),10),e[2]=/[a-zA-Z]/.test(h)?parseInt(h.replace(/^.*[a-zA-Z]+(.*)$/,"$1"),10):0);else if("undefined"!=typeof n.ActiveXObject)try{var k=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");k&&(h=k.GetVariable("$version"))&&(g=!0,h=h.split(" ")[1].split(","),e=[parseInt(h[0],10),parseInt(h[1],10),parseInt(h[2],10)])}catch(l){}return{w3:a,pv:e,wk:b,ie:g,win:f,mac:c}}(); (function(){e.w3&&(("undefined"!=typeof d.readyState&&"complete"==d.readyState||"undefined"==typeof d.readyState&&(d.getElementsByTagName("body")[0]||d.body))&&z(),w||("undefined"!=typeof d.addEventListener&&d.addEventListener("DOMContentLoaded",z,!1),e.ie&&e.win&&(d.attachEvent("onreadystatechange",function(){"complete"==d.readyState&&(d.detachEvent("onreadystatechange",arguments.callee),z())}),n==top&&function(){if(!w){try{d.documentElement.doScroll("left")}catch(a){setTimeout(arguments.callee, 0);return}z()}}()),e.wk&&function(){w||(/loaded|complete/.test(d.readyState)?z():setTimeout(arguments.callee,0))}(),Q(z)))})();(function(){e.ie&&e.win&&y.attachEvent("onunload",function(){for(var a=A.length,b=0;be.wk)&&a&&b&&c&&d&&g?(x(b,!1),v(function(){c+="";d+="";var e={};if(l&&"object"===typeof l)for(var m in l)e[m]=l[m];e.data=a;e.width=c;e.height=d;m={};if(k&&"object"===typeof k)for(var r in k)m[r]=k[r];if(h&&"object"===typeof h)for(var t in h)m.flashvars="undefined"!=typeof m.flashvars?m.flashvars+("&"+t+"="+h[t]):t+"="+h[t];if(E(g))r=O(e,m,b),e.id== b&&x(b,!0),p.success=!0,p.ref=r;else{if(q&&J()){e.data=q;K(e,m,b,n);return}x(b,!0)}n&&n(p)})):n&&n(p)},switchOffAutoHideShow:function(){U=!1},ua:e,getFlashPlayerVersion:function(){return{major:e.pv[0],minor:e.pv[1],release:e.pv[2]}},hasFlashPlayerVersion:E,createSWF:function(a,b,c){return e.w3?O(a,b,c):C},showExpressInstall:function(a,b,c,d){e.w3&&J()&&K(a,b,c,d)},removeSWF:function(a){e.w3&&S(a)},createCSS:function(a,b,c,d){e.w3&&T(a,b,c,d)},addDomLoadEvent:v,addLoadEvent:Q,getQueryParamValue:function(a){var b= d.location.search||d.location.hash;if(b){/\?/.test(b)&&(b=b.split("?")[1]);if(null==a)return V(b);for(var b=b.split("&"),c=0;cc?(l.componentsPending=!1,c+=1,f?g(a,e,d):b.delay(function(){g(a,e,d)},200)):(l.componentsPending=!0,e(q,n))};var n=function(){null!==f&&f!==v&&f.abort();l=new a;var b=k("#bundle-state");b.length&&(l.asin=b.data("asin"), l.isBundle=b.data("isbundle"))};g=function(){return l.isBundle&&""!==d()};d=function(){return l.asin};h=function(){return l.componentsAvailable};r=function(){return l.componentsPending};n();return{isBundle:g,getBundleASIN:d,hasComponentsAvailable:h,hasComponentsPending:r,loadBundleComponents:p,refresh:n}});"use strict";m.when("A","bundle-constants","bundle-logger","bundle-state","ready").register("bundle-pricing",function(b,a,k,f){var c=b.$,e=!1,g="",d=0,h,r,l,p,n,w,x,t,m;b.on(a.BUNDLE_PRICING_AJAX_TRIGGER_EVENT, function(){h(!1)});h=function(a){if(a||p())a={asin:f.getBundleASIN()},a.asin?l(a):(k.logWarning("Unable to find bundle asin, will retry","bundlePricingAjax"),r(!1))};l=function(a){b.get("/gp/product/ajax-handlers/get-bundle-pricing.html",{params:a,accepts:"text/html",timeout:2E3,success:n,failure:function(a,b,q){k.logWarning("Error in getBundlePricing, retrying.");r(!0,b,q)}})};r=function(a,c,e){3>d?(d+=1,b.delay(function(){h(!0)},200)):a&&k.logFatal(c,"bundlePricingAjax",e)};p=function(){var a=!e; a||g===f.getBundleASIN()?(e=!0,g=f.getBundleASIN()):(a=!0,g=f.getBundleASIN(),d=0);return a};n=function(a){b.objectIsEmpty(a)||(x(a),m(a),t(a),w(a))};w=function(b){b[a.BUNDLE_LISTING_WIDGET_V2_PRIME_ELIGIBLE]&&c(a.BUNDLE_PRICEBLOCK_PRIME_ELIGIBLE).removeClass("aok-hidden")};x=function(e){var d=e[a.BUNDLE_LISTING_WIDGET_V2_SAVINGS],g=e[a.BUNDLE_LISTING_WIDGET_V2_SAVINGS_LABEL],n=e[a.BUNDLE_LISTING_WIDGET_V2_YOU_SAVE],f=e[a.BUNDLE_LISTING_WIDGET_V2_YOU_SAVE_LABEL];e=e[a.BUNDLE_LISTING_WIDGET_V2_SAVINGS_NO_YOU_SAVE_LABEL]; b.objectIsEmpty(d)||b.objectIsEmpty(g)||b.objectIsEmpty(n)||b.objectIsEmpty(f)?b.objectIsEmpty(d)||b.objectIsEmpty(g)||b.objectIsEmpty(f)?b.objectIsEmpty(n)||b.objectIsEmpty(e)||(c(a.BUNDLE_PRICEBLOCK_YOU_SAVE_LABEL).html(e.trim()),c(a.BUNDLE_PRICEBLOCK_YOU_SAVE_NO_SAVINGS_PRICE).html(n.trim()),c(a.BUNDLE_PRICEBLOCK_SAVINGS_ROW).removeClass("aok-hidden"),c(a.BUNDLE_PRICEBLOCK_YOU_SAVE_NO_SAVINGS_COLUMN).removeClass("aok-hidden")):(c(a.BUNDLE_PRICEBLOCK_SAVINGS_NO_YOU_SAVE_PRICE).html(d.trim()),c(a.BUNDLE_PRICEBLOCK_SAVINGS_NO_YOU_SAVE_LABEL).html(f.trim()), c(a.BUNDLE_PRICEBLOCK_YOU_SAVE_LABEL).html(g.trim()),c(a.BUNDLE_PRICEBLOCK_SAVINGS_ROW).removeClass("aok-hidden"),c(a.BUNDLE_PRICEBLOCK_SAVINGS_NO_YOU_SAVE_COLUMN).removeClass("aok-hidden")):(c(a.BUNDLE_PRICEBLOCK_SAVINGS_PRICE).html(d.trim()),c(a.BUNDLE_PRICEBLOCK_SAVINGS_LABEL).html(f.trim()),c(a.BUNDLE_PRICEBLOCK_YOU_SAVE_PRICE).html(n.trim()),c(a.BUNDLE_PRICEBLOCK_YOU_SAVE_LABEL).html(g.trim()),c(a.BUNDLE_PRICEBLOCK_SAVINGS_ROW).removeClass("aok-hidden"),c(a.BUNDLE_PRICEBLOCK_SAVINGS_YOU_SAVE_COLUMN).removeClass("aok-hidden"))}; t=function(e){var d=e[a.BUNDLE_LISTING_WIDGET_V2_STRIKETHROUGH];e=e[a.BUNDLE_LISTING_WIDGET_V2_STRIKETHROUGH_LABEL];b.objectIsEmpty(d)||b.objectIsEmpty(e)||(c(a.BUNDLE_PRICEBLOCK_STRIKETHROUGH_PRICE).html(d.trim()),c(a.BUNDLE_PRICEBLOCK_STRIKETHROUGH_PRICE_LABEL).html(e.trim()),c(a.BUNDLE_PRICEBLOCK_STRIKETHROUGH_ROW).removeClass("aok-hidden"))};m=function(e){var d=e[a.BUNDLE_LISTING_WIDGET_V2_DEAL];e=e[a.BUNDLE_LISTING_WIDGET_V2_DEAL_LABEL];b.objectIsEmpty(d)||b.objectIsEmpty(e)||(c(a.BUNDLE_PRICEBLOCK_DEAL_PRICE).html(d.trim()), c(a.BUNDLE_PRICEBLOCK_DEAL_LABEL).html(e.trim()),c(a.BUNDLE_PRICEBLOCK_DEAL_ROW).removeClass("aok-hidden"))};return{parsePricingData:n,_retryCount:function(){return d}}});"use strict";m.when("A","ready").register("bundle-state",function(b){var a=b.$,k={bundleState:"#bundle-state"};return{elements:k,getBundleASIN:function(){var b=a(k.bundleState);if(b.length)return b.data("asin")}}});"use strict";m.when("A").register("bundle-logger",function(b){b=u.ue||!1;var a=b.count||!1,k=b.log||!1,f=u.ueLogError|| !1,c=function(a,b,c,h){"INFO"!==b&&f?(null!==h&&"object"===typeof h?h.message="["+a+"] "+h.message:h={message:"["+a+"]"},f(h,{logLevel:b,attribution:c,message:a})):"INFO"===b&&k&&k(a,c)};return{logCount:function(b,c){if(a)return a(b,c),a(b)},logInfo:function(a,b){c(a,"INFO",b,null)},logWarning:function(a,b,d){c(a,"WARN",b,d)},logError:function(a,b,d){c(a,"ERROR",b,d)},logFatal:function(a,b,d){c(a,"FATAL",b,d)}}});"use strict";m.when("A","ready").register("bundle-constants",function(){return{STRIKE_THROUGH_PRICE:"#bundle_strikethrough_price", BUNDLE_PRICE:"#bundle_price",YOU_SAVE:"#bundle_you_save",BUNDLE_DEAL_PRICE:"#bundle_deal_price",TOTAL_BOUGHT_SEPARATELY:"#bundle_total_bought_separately",BUNDLE_PRICEBLOCK_DEAL_PRICE:"#priceblock-bundle-deal-price",BUNDLE_PRICEBLOCK_DEAL_LABEL:"#priceblock-bundle-deal-label",BUNDLE_PRICEBLOCK_DEAL_ROW:"#priceblock-bundle-deal-row",BUNDLE_PRICEBLOCK_SAVINGS_PRICE:"#priceblock-bundle-savings-price",BUNDLE_PRICEBLOCK_SAVINGS_ROW:"#priceblock-bundle-savings-row",BUNDLE_PRICEBLOCK_SAVINGS_LABEL:"#priceblock-bundle-savings-label", BUNDLE_PRICEBLOCK_YOU_SAVE_LABEL:"#bundle-v2-savings-atf-you-save-label",BUNDLE_PRICEBLOCK_YOU_SAVE_PRICE:"#priceblock-bundle-you-save-price",BUNDLE_PRICEBLOCK_SAVINGS_NO_YOU_SAVE_PRICE:"#bundle-v2-savings-no-you-save-atf",BUNDLE_PRICEBLOCK_SAVINGS_NO_YOU_SAVE_LABEL:"#bundle-v2-savings-no-you-save-label-atf",BUNDLE_PRICEBLOCK_STRIKETHROUGH_PRICE:"#bundle-v2-price-strikethrough-atf",BUNDLE_PRICEBLOCK_STRIKETHROUGH_ROW:"#bundle-priceblock-strikethrough-row",BUNDLE_PRICEBLOCK_STRIKETHROUGH_PRICE_LABEL:"#bundle-v2-price-strikethrough-atf-label", BUNDLE_PRICEBLOCK_SAVINGS_NO_YOU_SAVE_COLUMN:"#bundle-v2-savings-no-you-save-atf-column",BUNDLE_PRICEBLOCK_SAVINGS_YOU_SAVE_COLUMN:"#bundle-v2-you-save-atf-column",BUNDLE_PRICEBLOCK_YOU_SAVE_NO_SAVINGS_COLUMN:"#bundle-v2-you-save-no-savings-atf-column",BUNDLE_PRICEBLOCK_YOU_SAVE_NO_SAVINGS_LABEL:"#bundle-v2-you-save-no-savings-atf-label",BUNDLE_PRICEBLOCK_YOU_SAVE_NO_SAVINGS_PRICE:"#bundle-v2-you-save-no-savings-atf-price",BUNDLE_PRICEBLOCK_LESS_THAN_BUYING_SEPERATELY_PRICE:"#priceblock-bundle-less-than-buying-seperately-price", BUNDLE_PRICEBLOCK_PRIME_ELIGIBLE:"#bundle-v2-atf-prime-logo",BUNDLE_LISTING_WIDGET_V2_STRIKETHROUGH:"bundle-listing-v2-strikethrough",BUNDLE_LISTING_WIDGET_V2_STRIKETHROUGH_LABEL:"bundle-listing-v2-strikethrough-label",BUNDLE_LISTING_WIDGET_V2_SAVINGS:"bundle-listing-v2-savings",BUNDLE_LISTING_WIDGET_V2_YOU_SAVE:"bundle-listing-v2-you-save",BUNDLE_LISTING_WIDGET_V2_YOU_SAVE_LABEL:"bundle-listing-v2-you-save-label",BUNDLE_LISTING_WIDGET_V2_DEAL:"bundle-listing-v2-deal",BUNDLE_LISTING_WIDGET_V2_DEAL_LABEL:"bundle-listing-v2-deal-label", BUNDLE_LISTING_WIDGET_V2_SAVINGS_LABEL:"bundle-listing-v2-savings-label",BUNDLE_LISTING_WIDGET_V2_SAVINGS_NO_YOU_SAVE_LABEL:"bundle-listing-v2-you-save-no-savings-label",BUNDLE_LISTING_WIDGET_V2_PRIME_ELIGIBLE:"bundle-listing-v2-prime-eligible",BUNDLE_LISTING_V2_READY_EVENT:"bundle-listing-V2:widget:ready",BUNDLE_LISTING_BOTTOM_SHEET_READY_EVENT:"bundle-listing:sheet:ready",BUNDLE_PRICING_AJAX_TRIGGER_EVENT:"bundle-pricing-ajax-trigger-event"}});"use strict";m.when("A","ready").execute(function(b){var a= b.$,k=2,f,c,e=!1,g,d=!1,h,m=function(){return b.interval(function(){b.onScreen("#customizable-secondary-view")&&!d&&c();d&&clearInterval(h)},500)};h=m();var l=function(c){e=!0;k=2;var d=a("#customizable_bundle_state"),f=a(c);c=a(f).find("#customizable-add-to-cart-token");d.length&&c.length&&(d=d.data("tiers"),b.each(d,function(b,c){c=a(f).find("#customizable-tier-ajax-"+b);a("#asin-faceouts-tier-"+b).html(c.html())}),b.trigger("customizable-faceouts-loaded",c))},p=function(c){var d=a("#customizable_bundle_state").data("tiers"); b.each(d,function(b,d){d=a("#asin-faceouts-tier-"+b);b=d.find(".a-spinner-wrapper");d=d.find("p");c?(b.addClass("aok-hidden"),d.removeClass("aok-hidden")):(b.removeClass("aok-hidden"),d.addClass("aok-hidden"))})};c=function(){d=!0;var c=a("#customizable_bundle_state").attr("data-asin");e&&c===g||(e=!1,g=c,p(!1),b.get("/gp/product/ajax-handlers/get-product-grouping-tiers.html",{params:{asin:c},accepts:"text/html",timeout:4E3,success:l,failure:f}))};f=function(a,d,e){0>=k?(b.trigger("customizable-faceouts-not-loaded"), p(!0)):(k--,c())};b.on("a:popover:beforeShow:customizable_bundle_secondary_view",c);b.on("a:popover:afterHide:customizable_bundle_secondary_view",function(){d=!1;k=2;h=m()})})}); /* ******** */ (function(c){var g=window.AmazonUIPageJS||window.P,h=g._namespace||g.attributeErrors,a=h?h("FreshDetailPageDesktopAssets",""):g;a.guardFatal?a.guardFatal(c)(a,window):a.execute(function(){c(a,window)})})(function(c,g,h){c.when("A","afx-update-cart-count","fresh-dp-prevent-atc-default","ready").register("fresh-dp-add-to-cart",function(a,b,k){var d=!1;return{init:function(a){d||(c.when("fresh-atc-handler").execute(function(a){a.addToFreshCart({success:function(a){},error:function(a,b,f,e){c.log("Error adding to Cart on Fresh Detail Page", "Error")}})}),d=!0);k.init()}}});c.when("A","afx-utils","ready").register("fresh-show-atc-changeover",function(a,b){var k=a.$,d=k("#afx-atc-changeover");return function(f){if(f&&0e.height()&&(k.addClass("expandableSection"),k.click(c),a("#fbExpanderMoreButtonSection").removeClass("aok-hidden"),a("#feature-bullets").find(".moreFB").click(c),e=a("#fbSection"),e.find(".closeFB").click(c),e.hover(null,function(){b.getIsExpanded()&&c()}))}}};return{init:function(){(new c(b)).init()}}});"use strict";c.when("A","jQuery","ready").execute(function(a,b){function c(){return b("#primeNowVariableWeightWhole").val()}function d(){return b("#primeNowVariableWeightFraction").length? b("#primeNowVariableWeightFraction").val():"0"}function f(){try{var e,f;var g=c(),h=d();if(g&&h){var l=parseFloat(g+"."+h);if(isNaN(l))throw"Not a valid number.";f=l}else throw"Not a valid number.";1===f?p.text(q.singular):p.text(q.plural);f*=r;if(isNaN(f))throw"Not a valid number.";e=t+f.toFixed(2);u.length&&u.text(e);b("#variableWeightPricePreview").show()}catch(m){a.trigger("dpLogFatalsEvent","[VariableWeight estimate total price failed: "+m+"]","FATAL","variableweight_estimatetotal_failure"), b("#variableWeightPricePreview").hide()}}function e(){b("#primeNowVariableWeightFraction").find("option").each(function(){0!==parseInt(b(this).val(),10)&&b(this).attr("disabled",!0)})}function g(){b("#primeNowVariableWeightFraction").find("option").each(function(){0===parseInt(b(this).val(),10)&&b(this).attr("disabled",!0)})}function h(){b("#primeNowVariableWeightWhole").find("option").each(function(){b(this).attr("disabled",!1)});b("#primeNowVariableWeightFraction").find("option").each(function(){b(this).attr("disabled", !1)})}function l(){h();var a=c();a===v?(e(),n(w)):0===parseInt(a,10)&&(g(),0===parseInt(d(),10)&&n(x))}function n(a){b("#primeNowVariableWeightFraction").val(a)}a.state("orderLimits");var m=a.state("offerListingMap"),q=a.state("sellingUnitFormsMap"),r,t,v=b("#primeNowVariableWeightWhole").find("option:last").val(),w=b("#primeNowVariableWeightFraction").find("option:first").val(),x=b("#primeNowVariableWeightFraction").val();m&&(r=parseFloat(m.priceMutiplier),t=m.currencySymbol);var u=b("#variableWeightPricingPreview"), p=b("#variableWeightSellingUnit");l();a.on("a:dropdown:primeNowVariableWeightWhole:select",function(a){l();f()});a.on("a:dropdown:primeNowVariableWeightFraction:select",function(a){l();f()})})}); /* ******** */ (function(f){var e=window.AmazonUIPageJS||window.P,r=e._namespace||e.attributeErrors,a=r?r("FreshDetailPageCommonAssets",""):e;a.guardFatal?a.guardFatal(f)(a,window):a.execute(function(){f(a,window)})})(function(f,e,r){f.when("A","jQuery","a-modal","afx-dp-uatc-proxy","afx-update-cart-count","a-dropdown","fresh-dp-double-click","afx-dp-csm-metrics-utils","fresh-show-atc-changeover","fresh-dp-quantity","afx-utils","ready").register("fresh-atc-handler",function(a,d,e,c,t,n,l,b,p,u,g){var m;f.when("EWC").execute(function(b){m= b});f.when("nav.getFlyout").execute(function(b){b("ewc")});var G={"itemPrice:priceUnavailable:1":"PRICE_UNAVAILABLE","itemDeleted:itemCountOverflow:6":"QUANTITY_OVERFLOW"};return{addToFreshCart:function(n){function k(b,a,d,h){x(b);n.error(b,a,d,h)}function x(D,c){c=c||{};var g=D.data.sessionID;c.title=y(D.data.title);c.asin=D.data.asin;c.offerListingID=D.data.offerListingID;c.sessionID=g;switch(c.reasonCode?c.reasonCode:r){case w.itemNotAvailable:b.increment(h.freshUATCItemNotAvailableErrorCountMetric); break;case w.itemPartiallyAvailable:b.increment(h.freshUATCItemPartiallyAvailableErrorCountMetric);break;case w.itemPartiallyAvailableForReservation:b.increment(h.freshUATCItemPartiallyAvailableForReservationErrorCountMetric);break;case w.itemNotAvailableForReservation:b.increment(h.freshUATCItemNotAvailableForReservationErrorCountMetric);break;case w.itemPriceUnavailable:b.increment(h.freshUATCItemPriceUnavailableErrorCountMetric);break;case w.itemCountOverflow:b.increment(h.freshUATCItemCountOverflowErrorCountMetric); break;default:b.increment(h.freshUATCEmptyItemStatusCodeErrorCountMetric),f.log("fresh-atc-handler: No error status code.","ERROR")}c=d.param(c);e.create(D.$currentTarget,{name:"fresh-add-to-cart-modal",sessionID:g,url:"/afx/cart/reservation_conflict?"+c}).show();a.on("a:popover:afterHide:fresh-add-to-cart-modal",function(b){B(g);e.remove(b.popover)})}function y(b){var a={"\x26amp;":"\x26"},d;for(d in a)a.hasOwnProperty(d)&&(b=b.replace(d,a[d]));return b}function E(b){return b.filter(function(b){return b.statusKey in G})}function z(b,a,d){d+=" returned by UATC is not an array";f.log(d,"Error",a);k(b,"","",d)}function A(g,e,n){n||(n=function(){});try{var v=g.data.asin;if(v)if(g.data.title){var p=g.data.offerListingID;if(p){var F=g.data.sessionID;if(F){var l=u.val();l||(f.log('fresh-atc-handler: "quantity" action parameter is missing.',"ERROR"),l=1);b.setWidgetClickTimestamp(h.freshUATCTCallScope);c({asin:v,offerListingID:p,sessionID:F,quantity:l,reftag:"afx-dp-addtocart",success:function(c){try{b.sendWidgetMetrics(h.freshUATCTCallScope); var v;if(c&&c.isOK){var p=c.extraErrorInfos;if(p&&p.constructor===Array&&0=m.length)){var r=m[0];if("ADDRESS_NOT_SELECTED"===r.statusCode){b.increment(h.freshUATCAddressNotSelectedErrorCountMetric); f.log("fresh-atc-handler: Address is not selected.","INFO");var A=d.param({asin:g.data.asin,offerListingID:g.data.offerListingID,quantity:1,redirectURL:document.location.href,ref:"afx_atfc_noaddress"});document.location.href="/afx/nc/chooseaddress?"+A}else x(g,{reasonCode:r.itemStatusCode,quantityAdded:r.availableQuantity,quantityRequested:r.requestedQuantity})}}else if(q&&q.constructor!==Array)z(g,q,"statusList");else if(0=q.length)){var y=E(q);y&&0a.length)f.log("Could not find the element that parents this modal (it should contain class a-popover wrapper)","FATAL");else{var d=a.find("#"+b.data.addButtonID),c;1>d.length?(f.log("Could not find the button that will add the item. This is required for preventing double clicks", "ERROR"),c=!1):b.data.asin?c=!0:(f.log("ASIN was blank. Please supply the ASIN you wish to add to the list.","ERROR"),c=!1);c&&(d=e(d),d.isEnabled()&&(d.disable(),b={asin:b.data.asin,addButtonInstance:d,$modalParent:a,cancelButtonID:b.data.cancelButtonID,shoppingListID:a.find("#"+b.data.asin+"-afx-atl-dropdown").val(),$alreadyInMessage:a.find("#afx-atl-already-in"),$errorMessage:a.find("#afx-atl-service-error")},b.$alreadyInMessage.addClass("aok-hidden"),b.$errorMessage.addClass("aok-hidden"),t(b), n(b)))}})});"use strict";f.when("A","jQuery","fresh-add-to-cart","fresh-dp-quantity","fresh-show-atc-changeover").execute(function(a,d,e,c,t){e.addToFreshCart({success:function(a,c){t(a.data.amountInUom?a.data.amountInUom+" lb":a.data.quantity);a=c.couponClipStatus;if("CLIP_SUCCESSFUL"===a||"ALREADY_CLIPPED"===a)d("#unclippedCoupon").hide(),d("#clippedCoupon").show()},error:function(a,d,b,c){}});c.init();a.on("a:pageUpdate",function(){c.init();e.updateQuantity("freshAddToCartButton",c.val())});e.updateQuantity("freshAddToCartButton", c.val());a.declarative("freshDetailPageQuantityUpdate","change",function(a){e.updateQuantity("freshAddToCartButton",c.val())});f.when("fresh-atfc-hook").execute(function(a){a.callback()})});f.when("A","jQuery","a-dropdown","fresh-dp-constants","fresh-add-to-cart","a-button").register("fresh-dp-quantity",function(a,d,e,c,f,n){return function(){var l,b,p,u,g,m,r,q,k,x,y,E,z,A=function(){if(!l){b=d(c.addToCartButtonSelector);g=e.getSelect(c.dropdownID);if(p=!!g){u=d(c.dropdownDivSelector);var a=g.getOptions().size(); a&&(r=a-1)}q=d(c.freeTextDivSelector);if(m=0!==q.length)k=d(c.freeTextInputSelector),x=d(c.freeTextErrorDivsSelector),y=d(c.freeTextErrorMsgMin),E=d(c.freeTextErrorMsgMax)}},B=function(){a.on(c.dropdownSelectedID,function(a){d(a.nativeItemNode).index()===r?(k.attr("validValue",z),k.val(z),q.show(),x.hide(),u.hide(),k.focus().select(),g.val("1")):z=g.val()});var h=function(){var a=k.attr("validValue");a&&(g.val(a),g.val()===a?(z=a,u.show(),q.hide()):(f.updateQuantity("freshAddToCartButton",a),b.focus()))}, e=function(){var a=C(k.val());k.attr("validValue",a?a:"")};k.change(e);k.keyup(e);k.keypress(function(a){if(0===a.which||8===a.which||a.ctrlKey||a.altKey||c.rxNumbersOnly.test(String.fromCharCode(a.which)))return!0;13===a.which&&(h(),b.click());return!1});k.blur(h)},C=function(){var a;a:{a=k.val();if(c.rxNumbersOnly.test(a)&&(a=parseInt(a,10),!isNaN(a)))break a;a=!1}x.hide();var b=n(c.addToCartButtonSelector);if(!1===a||0>=a)y.show(),b.isEnabled()&&b.disable();else if(1E3<=a)E.show();else return b.isEnabled()|| b.enable(),String(a);return!1};return{init:function(){l=!1;A();l=!0;if(m){q.hide().removeClass(c.auiHiddenClass);x.hide().removeClass(c.auiHiddenClass);var a=g.getOption(r),b=a.info()[0].text;a.update({value:"0",text:d.trim(b)+"+"});z=g.val();B()}},valid:function(){A();return m&&q.is(":visible")?!1!==C():!0},val:function(){A();return m&&q.is(":visible")?k.attr("validValue"):p?g.val():1}}}()});f.register("fresh-dp-constants",function(){return{actionPanelStateData:"apstate",actionPanelFreshState:"fresh", mobileNavSearchFormSelector:'#nav-search-form, form[role\x3d"search"], #searchForm',rxNumbersOnly:/^\d+$/,auiHiddenClass:"aok-hidden",addToCartButtonSelector:"#freshAddToCartButton",dropdownID:"freshQuantity",dropdownSelectedID:"a:dropdown:selected:freshQuantity",dropdownDivSelector:"#quantitySelect",freeTextDivSelector:"#quantityText",freeTextInputSelector:"#quantityTextInput",freeTextErrorDivsSelector:"#quantityTextErrors \x3e div",freeTextErrorMsgMin:"#quantityFreeTextErrorMsgMin",freeTextErrorMsgMax:"#quantityFreeTextErrorMsgMax"}}); f.when("A","ready").register("fresh-dp-prevent-atc-default",function(a){return{init:function(){a.$("#addToFreshCart").submit(function(a){a.preventDefault()})}}});"use strict";f.when("A","jQuery","a-button","ready").register("fresh-multiselleroffers-pagination-handler",function(a,d,e){function c(a){var c=parseInt(l.attr("data-currentPage"),10),e=parseInt(l.attr("data-pageCount"),10),c="next"===a?c+1:c-1;l.attr("data-currentPage",c);0===c?b.disable():b.enable();c===e-1?p.disable():p.enable();d(".freshMultiSellerOffer").addClass("hidden"); d('.freshMultiSellerOffer[data-page\x3d"'+c+'"]').removeClass("hidden")}var f=d("#freshMultiSellerOffersPreviousPage"),n=d("#freshMultiSellerOffersNextPage"),l=d("#freshMultiSellerOffersPagination"),b=e(f),p=e(n);a.declarative.create(f,"fresh-multiselleroffers-previous-page",{});a.declarative.create(n,"fresh-multiselleroffers-next-page",{});a.declarative("fresh-multiselleroffers-previous-page","click",function(a){b.isEnabled()&&c("previous")});a.declarative("fresh-multiselleroffers-next-page","click", function(a){p.isEnabled()&&c("next")})});"use strict";f.when("A").register("afx-dp-uatc-proxy",function(a){return function(d){var e="/gp/add-to-cart/json";d.reftag!==r&&(e+="/ref\x3d"+d.reftag);a.post(e,{timeout:5E3,params:{"session-id":d.sessionID,clientName:"SharedFreshHandler",nextPage:"cartitems",ASIN:d.asin,offerListingID:d.offerListingID,useUber:"1",source:"Fresh",ruleSet:"FreshGet",quantity:d.quantity},success:d.success,error:d.error})}});"use strict";f.when("A").register("afx-dp-get-cart-count", function(a){return function(d){a.get("/gp/api/cart/1.0/get-cart-count.json",{timeout:5E3,params:{sessionID:d.sessionID,clientName:"sharedFreshHandler"},success:d.success,error:d.error})}});"use strict";f.when("A").register("afx-dp-get-cart-item-count",function(a){return function(a,e){if(e&&e.items){var c;for(c=0;cb.bottom||0>b.right)a.attrs("originalFocus", null),a.hide()}})}function p(){var a=d(e);m.popoverHandle=c.create(a,{closeButton:!1,closeButtonLabel:a.attr("data-close-button-label")||"close",position:"triggerBottom",name:f,popoverLabel:a.attr("data-popover-label")||f,width:"400",activate:b.capabilities.touch?"onmouseover":"onclick"});b.capabilities.touch&&a.bind("touchend",function(b){m.popoverHandle.isActive()||a.trigger("mouseenter")});b.on("a:popover:afterShow:"+f,q);b.on("a:popover:afterHide:"+f,r);b.on("a:popover:afterUpdatePosition:"+f, t)}function u(){k=d("#actionPanelOverlay");if(!k.length){var a=document.createElement("div");h.length&&(a.id="actionPanelOverlay",k=d(a).addClass("action-panel-overlay").css({width:h.outerWidth(),top:h.position().top}).bind("touchend click",function(a){return!1}),h.append(a))}}function t(a){var b,c=a.popover.$trigger.get(0).getBoundingClientRect();b=g.pageYOffset?g.pageYOffset:"CSS1Compat"===(document.compatMode||"")?document.documentElement.scrollTop:document.body.scrollTop;var d=h.get(0).getBoundingClientRect().left+ 8;a.popover.$container.css({top:c.top+b+"px",left:d+"px"})}function n(){var a=h.get(0).getBoundingClientRect();k.css("height",a.bottom-a.top+"px")}function q(a){n();k.show();a.popover.$container.hasClass("burj-action-panel-modified-popover")||a.popover.$container.addClass("burj-action-panel-modified-popover");a.popover.$trigger.trigger("ActionPanelModifiedPopover.showPopover",a)}function r(a){k.hide();a.popover.$trigger.trigger("ActionPanelModifiedPopover.hidePopover",a)}var h=d("#actionPanel"),k, m=this;h.length&&(p(),u(),l(),d(g).resize(n))}});e.when("jQuery").register("action-panel",function(b){var d="ap-onetime ap-sns ap-deal ap-pospromo ap-mom ap-fresh ap-oos ap-b2brd ap-used ap-sampling".split(" ");return{setPanelState:function(c){if(c.mode){for(var f=b("#actionPanel"),e=0;ek.height()&&(g.addClass("expandableSection"),g.click(function(){d()}),a("#fbExpanderMoreButtonSection").removeClass("aok-hidden"), b.find(".moreFB").click(function(){d()}),c.find(".closeFB").click(function(){d()}),c.hover(null,function(){f&&d()}))}}});e.when("jQuery","atf").register("title-burj",function(a){var f,b,c,d,k,g,q,n,r,l,m,p,u,v=function(){k.text(g);if(m&&f.height()c;c++){var r=a.state("ctsStateInfo"+c);a.objectIsEmpty(r)||d.push(r)}else d=c.surfaces;d.length&&a.each(d,function(c){if(c.FontSettings&&c.FontSettings.fonts){var d= c.FontSettings.fonts;a.each(d,function(a){if(a.fontURL&&a.isActive){var c;c=d.length;a=a.fontURL.split("/");1>a.length?c=null:(a=a[a.length-1].split("."),c=1>a.length?null:"ac_"+c+"_"+a[0].substring(0,20));c&&e("\x3cspan\x3e\x26nbsp;\x3c/span\x3e").css("font-family",c).appendTo("body")}})}})})()});"use strict";g.register("acc-text-validator",function(){return{validate:function(a,e,d,c){parseInt(a.length,10)>e&&(a=a.substring(0,e),d.val(a));d=a;a=parseInt(d.length,10);0b?"-":"",k=parseInt(C(Math.abs(b||0),p),10)+"",u=3b?k.neg:k.zero).replace("%s",h.symbol).replace("%v",y(Math.abs(b),l(h.precision),h.thousand,h.decimal))};f.formatColumn=function(b,x,v,q,n,p){if(!b)return[];var h=c(d(x)?x:{symbol:x,precision:v,thousand:q,decimal:n, format:p},f.settings.currency),k=m(h.format),u=k.pos.indexOf("%s")a?k.neg:k.zero).replace("%s",h.symbol).replace("%v",y(Math.abs(a),l(h.precision),h.thousand,h.decimal));a.length>t&&(t=a.length);return a});return g(b,function(b,c){return a(b)&&b.length.9*g||b.width>.9*y);)m--,a.css({"font-size":m+"px"}),h=a.height(),b.setFontSize(m);b.set({top:c+(g-b.height)/2,left:f+(y-b.width)/ 2});d.add(b)}function q(d,a){var b=e.Deferred(),c=a.imageData;if(c){var f=c.isCustomerImage;a=e(c.element).data("original-width");var g=e(c.element).data("original-height"),k={transparentCorners:!1,centeredScaling:!0,lockUniScaling:!0},m={selectable:!1,width:d.width,height:d.height},l=e.extend({},f?k:m,c);n.Image.fromURL(h(c,{width:a,height:g},{width:3200,height:3200}),function(a){if(f&&!l.top){var e=Math.max(a.height/d.height,a.width/d.width);1e;)e+=f[t++%k],e>g&&(e=g),b[w?"lineTo":"moveTo"](e,0),w=!w;b.restore()},createCanvasElement:function(b){b||(b=f.document.createElement("canvas"));b.getContext||"undefined"===typeof G_vmlCanvasManager||G_vmlCanvasManager.initElement(b);return b},createImage:function(){return f.isLikelyNode?new (require("canvas").Image):f.document.createElement("img")}, createAccessors:function(b){b=b.prototype;for(var e=b.stateProperties.length;e--;){var a=b.stateProperties[e],c=a.charAt(0).toUpperCase()+a.slice(1),g="set"+c,c="get"+c;b[c]||(b[c]=new Function('return this.get("'+a+'")'));b[g]||(b[g]=new Function("value",'return this.set("'+a+'", value)'))}},clipContext:function(b,e){e.save();e.beginPath();b.clipTo(e);e.clip()},multiplyTransformMatrices:function(b,e,a){return[b[0]*e[0]+b[2]*e[1],b[1]*e[0]+b[3]*e[1],b[0]*e[2]+b[2]*e[3],b[1]*e[2]+b[3]*e[3],a?0:b[0]* e[4]+b[2]*e[5]+b[4],a?0:b[1]*e[4]+b[3]*e[5]+b[5]]},qrDecompose:function(b){var e=d(b[1],b[0]),c=a(b[0],2)+a(b[1],2),f=h(c),k=(b[0]*b[3]-b[2]*b[1])/f,c=d(b[0]*b[2]+b[1]*b[3],c);return{angle:e/g,scaleX:f,scaleY:k,skewX:c/g,skewY:0,translateX:b[4],translateY:b[5]}},customTransformMatrix:function(b,e,a){a=[1,0,c(Math.tan(a*g)),1];b=[c(b),0,0,c(e)];return f.util.multiplyTransformMatrices(b,a,!0)},resetObjectTransform:function(b){b.scaleX=1;b.scaleY=1;b.skewX=0;b.skewY=0;b.flipX=!1;b.flipY=!1;b.setAngle(0)}, getFunctionBody:function(b){return(String(b).match(/function[^{]*\{([\s\S]*)\}/)||{})[1]},isTransparent:function(b,e,a,c){0c?e-c:0,a=a>c?a-c:0);var g=!0;b=b.getImageData(e,a,2*c||1,2*c||1);e=3;for(a=b.data.length;e=b.data[e],!1!==g);e+=4);return g},parsePreserveAspectRatioAttribute:function(b){var e="meet",a;(b=b.split(" "))&&b.length&&(e=b.pop(),"meet"!==e&&"slice"!==e?(a=e,e="meet"):b.length&&(a=b.pop()));b="none"!==a?a.slice(1,4):"none";a="none"!==a?a.slice(5,8):"none";return{meetOrSlice:e, alignX:b,alignY:a}}}})("undefined"!==typeof p?p:this);(function(){function k(b,a,g,f,k,t,w){var x=e.call(arguments);if(c[x])return c[x];var u=Math.PI,A=w*u/180,E=Math.sin(A),A=Math.cos(A),p=0,D=0;g=Math.abs(g);f=Math.abs(f);var B=-A*b*.5-E*a*.5,v=-A*a*.5+E*b*.5,z=g*g,y=f*f,C=v*v,q=B*B,F=z*y-z*C-y*q,I=0;0>F?(z=Math.sqrt(1-F/(z*y)),g*=z,f*=z):I=(k===t?-1:1)*Math.sqrt(F/(z*C+y*q));C=I*g*v/f;q=-I*f*B/g;I=A*C-E*q+.5*b;z=E*C+A*q+.5*a;y=d(1,0,(B-C)/g,(v-q)/f);v=d((B-C)/g,(v-q)/f,(-B-C)/g,(-v-q)/f);0===t&& 0v&&(v+=2*u);u=Math.ceil(Math.abs(v/u*2));B=[];v/=u;C=8/3*Math.sin(v/4)*Math.sin(v/4)/Math.sin(v/2);q=y+v;for(F=0;F=b?a-b:2*Math.PI-(b-a)}function a(a,c,g,d,h,f,k,x){var u=e.call(arguments);if(b[u])return b[u];var A=Math.sqrt,p=Math.min,H=Math.max,D=Math.abs,B=[],v=[[],[]],z,y,C,q,F;y=6*a-12*g+6*h;z=-3*a+9*g-9*h+3*k;C=3*g-3*a;for(var I=0;2>I;++I)0D(z)?1E-12>D(y)||(q=-C/y,0q&&B.push(q)):(q=y*y-4*C*z,0>q||(F=A(q),q=(-y+F)/(2*z),0q&&B.push(q),q=(-y-F)/(2*z),0q&&B.push(q)));for(D=A=B.length;A--;)q= B[A],y=1-q,z=y*y*y*a+3*y*y*q*g+3*y*q*q*h+q*q*q*k,v[0][A]=z,z=y*y*y*c+3*y*y*q*d+3*y*q*q*f+q*q*q*x,v[1][A]=z;v[0][D]=a;v[1][D]=c;v[0][D+1]=k;v[1][D+1]=x;p=[{x:p.apply(null,v[0]),y:p.apply(null,v[1])},{x:H.apply(null,v[0]),y:H.apply(null,v[1])}];return b[u]=p}var c={},g={},b={},e=Array.prototype.join;f.util.drawArc=function(b,e,a,c){var g=[[],[],[],[]];c=k(c[5]-e,c[6]-a,c[0],c[1],c[3],c[4],c[2]);for(var d=0,h=c.length;d>>0;if(0===c)return-1;var g=0;0=c)return-1;for(g=0<=g?g:Math.max(c-Math.abs(g),0);g>>0;c>>0;g>>0;c>>0;c>>0;b>>0,c=0,g;if(1=a)throw new TypeError;}while(1)}for(;c=g})}}})();(function(){function k(h,d){for(var a in d)h[a]=d[a];return h}f.util.object={extend:k,clone:function(h){return k({},h)}}})();(function(){String.prototype.trim||(String.prototype.trim= function(){return this.replace(/^[\s\xA0]+/,"").replace(/[\s\xA0]+$/,"")});f.util.string={camelize:function(f){return f.replace(/-+(.)?/g,function(h,d){return d?d.toUpperCase():""})},capitalize:function(f,h){return f.charAt(0).toUpperCase()+(h?f.slice(1):f.slice(1).toLowerCase())},escapeXml:function(f){return f.replace(/&/g,"\x26amp;").replace(/"/g,"\x26quot;").replace(/'/g,"\x26apos;").replace(//g,"\x26gt;")}}})();(function(){var f=Array.prototype.slice,h=Function.prototype.apply, d=function(){};Function.prototype.bind||(Function.prototype.bind=function(a){var c=this,g=f.call(arguments,1),b;b=g.length?function(){return h.call(c,this instanceof d?this:a,g.concat(f.call(arguments)))}:function(){return h.call(c,this instanceof d?this:a,arguments)};d.prototype=this.prototype;b.prototype=new d;return b})})();(function(){function k(){}function h(b){var e=this.constructor.superclass.prototype[b];return 1c?c:a);if(1===a&&1===c&&0===g&&0===d&&0===l&&0===k)return t;if(l||k)w=" translate("+u(l)+" "+u(k)+") ";a=w+" matrix("+a+" 0 0 "+c+" "+g* a+" "+d*c+") ";if("svg"===b.tagName){for(c=b.ownerDocument.createElement("g");null!=b.firstChild;)c.appendChild(b.firstChild);b.appendChild(c)}else c=b,a=c.getAttribute("transform")+a;c.setAttribute("transform",a);return t}function l(b){var e=b.objects;b=b.options;e=e.map(function(b){return m[t(b.type)].fromObject(b)});return{objects:e,options:b}}function r(b,e,a){e[a]&&e[a].toSVG&&b.push('\t\x3cpattern x\x3d"0" y\x3d"0" id\x3d"',a,'Pattern" ','width\x3d"',e[a].source.width,'" height\x3d"',e[a].source.height, '" patternUnits\x3d"userSpaceOnUse"\x3e\n','\t\t\x3cimage x\x3d"0" y\x3d"0" ','width\x3d"',e[a].source.width,'" height\x3d"',e[a].source.height,'" xlink:href\x3d"',e[a].source.src,'"\x3e\x3c/image\x3e\n\t\x3c/pattern\x3e\n')}var m=f.fabric||(f.fabric={}),G=m.util.object.extend,t=m.util.string.capitalize,w=m.util.object.clone,x=m.util.toFixed,u=m.util.parseUnit,p=m.util.multiplyTransformMatrices,E=/^(path|circle|polygon|polyline|ellipse|rect|line|image|text)$/i,H=/^(symbol|image|marker|pattern|view|svg)$/i, D=/^(?:pattern|defs|symbol|metadata)$/i,B=/^(symbol|g|a|svg)$/i,v={cx:"left",x:"left",r:"radius",cy:"top",y:"top",display:"visible",visibility:"visible",transform:"transformMatrix","fill-opacity":"fillOpacity","fill-rule":"fillRule","font-family":"fontFamily","font-size":"fontSize","font-style":"fontStyle","font-weight":"fontWeight","stroke-dasharray":"strokeDashArray","stroke-linecap":"strokeLineCap","stroke-linejoin":"strokeLineJoin","stroke-miterlimit":"strokeMiterLimit","stroke-opacity":"strokeOpacity", "stroke-width":"strokeWidth","text-decoration":"textDecoration","text-anchor":"originX"},z={stroke:"strokeOpacity",fill:"fillOpacity"};m.cssRules={};m.gradientDefs={};m.parseTransformAttribute=function(){function b(e,a){var c=a[0],g=3===a.length?a[1]:0;a=3===a.length?a[2]:0;e[0]=Math.cos(c);e[1]=Math.sin(c);e[2]=-Math.sin(c);e[3]=Math.cos(c);e[4]=g-(e[0]*g+e[2]*a);e[5]=a-(e[1]*g+e[3]*a)}function e(b,a){var c=2===a.length?a[1]:a[0];b[0]=a[0];b[3]=c}function a(b,e){b[4]=e[0];2===e.length&&(b[5]=e[1])} var c=[1,0,0,1,0,0],g=m.reNum,d="(?:"+("(?:(matrix)\\s*\\(\\s*("+g+")(?:\\s+,?\\s*|,\\s*)("+g+")(?:\\s+,?\\s*|,\\s*)("+g+")(?:\\s+,?\\s*|,\\s*)("+g+")(?:\\s+,?\\s*|,\\s*)("+g+")(?:\\s+,?\\s*|,\\s*)("+g+")\\s*\\))")+"|"+("(?:(translate)\\s*\\(\\s*("+g+")(?:(?:\\s+,?\\s*|,\\s*)("+g+"))?\\s*\\))")+"|"+("(?:(scale)\\s*\\(\\s*("+g+")(?:(?:\\s+,?\\s*|,\\s*)("+g+"))?\\s*\\))")+"|"+("(?:(rotate)\\s*\\(\\s*("+g+")(?:(?:\\s+,?\\s*|,\\s*)("+g+")(?:\\s+,?\\s*|,\\s*)("+g+"))?\\s*\\))")+"|"+("(?:(skewX)\\s*\\(\\s*("+ g+")\\s*\\))")+"|"+("(?:(skewY)\\s*\\(\\s*("+g+")\\s*\\))")+")",f=new RegExp("^\\s*(?:"+("(?:"+d+"(?:(?:\\s+,?\\s*|,\\s*)*"+d+")*)")+"?)\\s*$"),h=new RegExp(d,"g");return function(g){var n=c.concat(),l=[];if(!g||g&&!f.test(g))return n;g.replace(h,function(g){var f=(new RegExp(d)).exec(g).filter(function(b){return""!==b&&null!=b});g=f[1];f=f.slice(2).map(parseFloat);switch(g){case "translate":a(n,f);break;case "rotate":f[0]=m.util.degreesToRadians(f[0]);b(n,f);break;case "scale":e(n,f);break;case "skewX":n[2]= Math.tan(m.util.degreesToRadians(f[0]));break;case "skewY":n[1]=Math.tan(m.util.degreesToRadians(f[0]));break;case "matrix":n=f}l.push(n.concat());n=c.concat()});for(g=l[0];1/i,"")));d&&d.documentElement&&m.parseSVGDocument(d.documentElement,function(a,c){C.set(b,{objects:m.util.array.invoke(a,"toObject"),options:c});e(a,c)},a)}b=b.replace(/^\n\s*/,"").trim();C.has(b,function(a){a?C.get(b,function(b){b=l(b);e(b.objects,b.options)}):new m.util.request(b,{method:"get",onComplete:c})})}, loadSVGFromString:function(b,e,a){b=b.trim();var c;if("undefined"!==typeof DOMParser){var g=new DOMParser;g&&g.parseFromString&&(c=g.parseFromString(b,"text/xml"))}else m.window.ActiveXObject&&(c=new ActiveXObject("Microsoft.XMLDOM"),c.async="false",c.loadXML(b.replace(//i,"")));m.parseSVGDocument(c.documentElement,function(b,a){e(b,a)},a)},createSVGFontFacesMarkup:function(b){for(var e="",a={},c,g,d,f,h=m.fontPaths,n=0,l=b.length;nd.x&&this.y>d.y},gte:function(d){return this.x>=d.x&&this.y>=d.y},lerp:function(d,a){return new h(this.x+(d.x-this.x)*a,this.y+(d.y-this.y)*a)},distanceFrom:function(d){var a=this.x-d.x;d=this.y-d.y;return Math.sqrt(a*a+d*d)},midPointFrom:function(d){return new h(this.x+(d.x-this.x)/2,this.y+(d.y-this.y)/2)},min:function(d){return new h(Math.min(this.x,d.x),Math.min(this.y,d.y))},max:function(d){return new h(Math.max(this.x,d.x),Math.max(this.y,d.y))}, toString:function(){return this.x+","+this.y},setXY:function(d,a){this.x=d;this.y=a},setFromPoint:function(d){this.x=d.x;this.y=d.y},swap:function(d){var a=this.x,c=this.y;this.x=d.x;this.y=d.y;d.x=a;d.y=c}})})("undefined"!==typeof p?p:this);(function(f){function h(a){this.status=a;this.points=[]}var d=f.fabric||(f.fabric={});d.Intersection?d.warn("fabric.Intersection is already defined"):(d.Intersection=h,d.Intersection.prototype={appendPoint:function(a){this.points.push(a)},appendPoints:function(a){this.points= this.points.concat(a)}},d.Intersection.intersectLineLine=function(a,c,g,b){var e,f=(b.x-g.x)*(a.y-g.y)-(b.y-g.y)*(a.x-g.x);e=(c.x-a.x)*(a.y-g.y)-(c.y-a.y)*(a.x-g.x);g=(b.y-g.y)*(c.x-a.x)-(b.x-g.x)*(c.y-a.y);0!==g?(f/=g,e/=g,0<=f&&1>=f&&0<=e&&1>=e?(e=new h("Intersection"),e.points.push(new d.Point(a.x+f*(c.x-a.x),a.y+f*(c.y-a.y)))):e=new h):e=0===f||0===e?new h("Coincident"):new h("Parallel");return e},d.Intersection.intersectLinePolygon=function(a,c,g){for(var b=new h,e=g.length,d=0;db&&(b+=1);1b?g:b<2/3?a+(g-a)*(2/3-b)*6:a}var a=f.fabric||(f.fabric= {});a.Color?a.warn("fabric.Color is already defined."):(a.Color=h,a.Color.prototype={_tryParsingColor:function(a){var g;a in h.colorNameMap&&(a=h.colorNameMap[a]);"transparent"===a?this.setSource([255,255,255,0]):((g=h.sourceFromHex(a))||(g=h.sourceFromRgb(a)),g||(g=h.sourceFromHsl(a)),g&&this.setSource(g))},_rgbToHsl:function(c,g,b){c/=255;g/=255;b/=255;var e,d,f,h=a.util.array.max([c,g,b]);d=a.util.array.min([c,g,b]);f=(h+d)/2;if(h===d)e=d=0;else{var k=h-d;d=.5d;d++)g.push(Math.round(.5*e[d]+.5*a[d]));g[3]=b;this.setSource(g);return this}},a.Color.reRGBa= /^rgba?\(\s*(\d{1,3}(?:\.\d+)?\%?)\s*,\s*(\d{1,3}(?:\.\d+)?\%?)\s*,\s*(\d{1,3}(?:\.\d+)?\%?)\s*(?:\s*,\s*(\d+(?:\.\d+)?)\s*)?\)$/,a.Color.reHSLa=/^hsla?\(\s*(\d{1,3})\s*,\s*(\d{1,3}\%)\s*,\s*(\d{1,3}\%)\s*(?:\s*,\s*(\d+(?:\.\d+)?)\s*)?\)$/,a.Color.reHex=/^#?([0-9a-f]{6}|[0-9a-f]{3})$/i,a.Color.colorNameMap={aqua:"#00FFFF",black:"#000000",blue:"#0000FF",fuchsia:"#FF00FF",gray:"#808080",green:"#008000",lime:"#00FF00",maroon:"#800000",navy:"#000080",olive:"#808000",orange:"#FFA500",purple:"#800080", red:"#FF0000",silver:"#C0C0C0",teal:"#008080",white:"#FFFFFF",yellow:"#FFFF00"},a.Color.fromRgb=function(a){return h.fromSource(h.sourceFromRgb(a))},a.Color.sourceFromRgb=function(a){if(a=a.match(h.reRGBa)){var g=parseInt(a[1],10)/(/%$/.test(a[1])?100:1)*(/%$/.test(a[1])?255:1),b=parseInt(a[2],10)/(/%$/.test(a[2])?100:1)*(/%$/.test(a[2])?255:1),e=parseInt(a[3],10)/(/%$/.test(a[3])?100:1)*(/%$/.test(a[3])?255:1);return[parseInt(g,10),parseInt(b,10),parseInt(e,10),a[4]?parseFloat(a[4]):1]}},a.Color.fromRgba= h.fromRgb,a.Color.fromHsl=function(a){return h.fromSource(h.sourceFromHsl(a))},a.Color.sourceFromHsl=function(a){if(a=a.match(h.reHSLa)){var g=(parseFloat(a[1])%360+360)%360/360,b=parseFloat(a[2])/(/%$/.test(a[2])?100:1),e=parseFloat(a[3])/(/%$/.test(a[3])?100:1);if(0===b)e=b=g=e;else var f=.5>=e?e*(b+1):e+b-e*b,l=2*e-f,e=d(l,f,g+1/3),b=d(l,f,g),g=d(l,f,g-1/3);return[Math.round(255*e),Math.round(255*b),Math.round(255*g),a[4]?parseFloat(a[4]):1]}},a.Color.fromHsla=h.fromHsl,a.Color.fromHex=function(a){return h.fromSource(h.sourceFromHex(a))}, a.Color.sourceFromHex=function(a){if(a.match(h.reHex)){var g=a.slice(a.indexOf("#")+1),b=3===g.length;a=b?g.charAt(0)+g.charAt(0):g.substring(0,2);var e=b?g.charAt(1)+g.charAt(1):g.substring(2,4),g=b?g.charAt(2)+g.charAt(2):g.substring(4,6);return[parseInt(a,16),parseInt(e,16),parseInt(g,16),1]}},a.Color.fromSource=function(a){var g=new h;g.setSource(a);return g})})("undefined"!==typeof p?p:this);(function(){if(f.StaticCanvas)f.warn("fabric.StaticCanvas is already defined.");else{var k=f.util.object.extend, h=f.util.getElementOffset,d=f.util.removeFromArray,a=f.util.toFixed,c=Error("Could not initialize `canvas` element");f.StaticCanvas=f.util.createClass({initialize:function(a,b){b||(b={});this._initStatic(a,b)},backgroundColor:"",backgroundImage:null,overlayColor:"",overlayImage:null,includeDefaultValues:!0,stateful:!0,renderOnAddRemove:!0,clipTo:null,controlsAboveOverlay:!1,allowTouchScrolling:!1,imageSmoothingEnabled:!0,preserveObjectStacking:!1,viewportTransform:[1,0,0,1,0,0],onBeforeScaleRotate:function(){}, enableRetinaScaling:!0,_initStatic:function(a,b){this._objects=[];this._createLowerCanvas(a);this._initOptions(b);this._setImageSmoothing();this.interactive||this._initRetinaScaling();b.overlayImage&&this.setOverlayImage(b.overlayImage,this.renderAll.bind(this));b.backgroundImage&&this.setBackgroundImage(b.backgroundImage,this.renderAll.bind(this));b.backgroundColor&&this.setBackgroundColor(b.backgroundColor,this.renderAll.bind(this));b.overlayColor&&this.setOverlayColor(b.overlayColor,this.renderAll.bind(this)); this.calcOffset()},_isRetinaScaling:function(){return 1!==f.devicePixelRatio&&this.enableRetinaScaling},_initRetinaScaling:function(){this._isRetinaScaling()&&(this.lowerCanvasEl.setAttribute("width",this.width*f.devicePixelRatio),this.lowerCanvasEl.setAttribute("height",this.height*f.devicePixelRatio),this.contextContainer.scale(f.devicePixelRatio,f.devicePixelRatio))},calcOffset:function(){this._offset=h(this.lowerCanvasEl);return this},setOverlayImage:function(a,b,e){return this.__setBgOverlayImage("overlayImage", a,b,e)},setBackgroundImage:function(a,b,e){return this.__setBgOverlayImage("backgroundImage",a,b,e)},setOverlayColor:function(a,b){return this.__setBgOverlayColor("overlayColor",a,b)},setBackgroundColor:function(a,b){return this.__setBgOverlayColor("backgroundColor",a,b)},_setImageSmoothing:function(){var a=this.getContext();"undefined"!==typeof a.imageSmoothingEnabled?a.imageSmoothingEnabled=this.imageSmoothingEnabled:(a.webkitImageSmoothingEnabled=this.imageSmoothingEnabled,a.mozImageSmoothingEnabled= this.imageSmoothingEnabled,a.msImageSmoothingEnabled=this.imageSmoothingEnabled,a.oImageSmoothingEnabled=this.imageSmoothingEnabled)},__setBgOverlayImage:function(a,b,e,c){"string"===typeof b?f.util.loadImage(b,function(b){this[a]=new f.Image(b,c);e&&e(b)},this,c&&c.crossOrigin):(c&&b.setOptions(c),this[a]=b,e&&e(b));return this},__setBgOverlayColor:function(a,b,e){if(b&&b.source){var c=this;f.util.loadImage(b.source,function(d){c[a]=new f.Pattern({source:d,repeat:b.repeat,offsetX:b.offsetX,offsetY:b.offsetY}); e&&e()})}else this[a]=b,e&&e();return this},_createCanvasElement:function(){var a=f.document.createElement("canvas");a.style||(a.style={});if(!a)throw c;this._initCanvasElement(a);return a},_initCanvasElement:function(a){f.util.createCanvasElement(a);if("undefined"===typeof a.getContext)throw c;},_initOptions:function(a){for(var b in a)this[b]=a[b];this.width=this.width||parseInt(this.lowerCanvasEl.width,10)||0;this.height=this.height||parseInt(this.lowerCanvasEl.height,10)||0;this.lowerCanvasEl.style&& (this.lowerCanvasEl.width=this.width,this.lowerCanvasEl.height=this.height,this.lowerCanvasEl.style.width=this.width+"px",this.lowerCanvasEl.style.height=this.height+"px",this.viewportTransform=this.viewportTransform.slice())},_createLowerCanvas:function(a){this.lowerCanvasEl=f.util.getById(a)||this._createCanvasElement();this._initCanvasElement(this.lowerCanvasEl);f.util.addClass(this.lowerCanvasEl,"lower-canvas");this.interactive&&this._applyCanvasStyle(this.lowerCanvasEl);this.contextContainer= this.lowerCanvasEl.getContext("2d")},getWidth:function(){return this.width},getHeight:function(){return this.height},setWidth:function(a,b){return this.setDimensions({width:a},b)},setHeight:function(a,b){return this.setDimensions({height:a},b)},setDimensions:function(a,b){var e;b=b||{};for(var c in a)e=a[c],b.cssOnly||(this._setBackstoreDimension(c,a[c]),e+="px"),b.backstoreOnly||this._setCssDimension(c,e);this._initRetinaScaling();this._setImageSmoothing();this.calcOffset();b.cssOnly||this.renderAll(); return this},_setBackstoreDimension:function(a,b){this.lowerCanvasEl[a]=b;this.upperCanvasEl&&(this.upperCanvasEl[a]=b);this.cacheCanvasEl&&(this.cacheCanvasEl[a]=b);this[a]=b;return this},_setCssDimension:function(a,b){this.lowerCanvasEl.style[a]=b;this.upperCanvasEl&&(this.upperCanvasEl.style[a]=b);this.wrapperEl&&(this.wrapperEl.style[a]=b);return this},getZoom:function(){return Math.sqrt(this.viewportTransform[0]*this.viewportTransform[3])},setViewportTransform:function(a){var b=this.getActiveGroup(); this.viewportTransform=a;this.renderAll();a=0;for(var e=this._objects.length;a=b?b=0:(b=h*Math.atan(b/g["scale"+k]/(t[a]/g["scale"+w])),b=f.util.radiansToDegrees(b));g.set("skew"+k,b);0!==g["skew"+w]&&(k=g._getTransformedDimensions(),b=d[a]/k[a]*g["scale"+w],g.set("scale"+w,b))},_scaleObject:function(a,e,c){var d=this._currentTransform,g=d.target,h=g.get("lockScalingX"),k=g.get("lockScalingY"),t=g.get("lockScalingFlip"); if(!h||!k){var w=g.translateToOriginPoint(g.getCenterPoint(),d.originX,d.originY);a=g.toLocalPoint(new f.Point(a,e),d.originX,d.originY);e=g._getTransformedDimensions();this._setLocalMouse(a,d);this._setObjectScale(a,d,h,k,c,t,e);g.setPositionByOrigin(w,d.originX,d.originY)}},_setObjectScale:function(a,e,c,d,g,f,h){var k=e.target,w=!1,x=!1;e.newScaleX=a.x*k.scaleX/h.x;e.newScaleY=a.y*k.scaleY/h.y;f&&0>=e.newScaleX&&e.newScaleX=e.newScaleY&&e.newScaleYa.newScaleX&&"y"!==e&&("left"===a.originX?a.originX="right":"right"===a.originX&&(a.originX="left"));0>a.newScaleY&&"x"!==e&&("top"===a.originY?a.originY="bottom":"bottom"===a.originY&&(a.originY="top"))},_setLocalMouse:function(a,e){var d=e.target;"right"===e.originX?a.x*=-1:"center"===e.originX&&(a.x=2*a.x*e.mouseXSign,0>a.x&&(e.mouseXSign=-e.mouseXSign));"bottom"===e.originY?a.y*=-1:"center"===e.originY&&(a.y=2*a.y*e.mouseYSign,0>a.y&&(e.mouseYSign=-e.mouseYSign)); c(a.x)>d.padding?a.x=0>a.x?a.x+d.padding:a.x-d.padding:a.x=0;c(a.y)>d.padding?a.y=0>a.y?a.y+d.padding:a.y-d.padding:a.y=0},_rotateObject:function(b,e){var c=this._currentTransform;if(!c.target.get("lockRotation")){var g=a(c.ey-c.top,c.ex-c.left);b=a(e-c.top,b-c.left);g=d(b-g+c.theta);0>g&&(g=360+g);c.target.angle=g%360}},setCursor:function(a){this.upperCanvasEl.style.cursor=a},_resetObjectTransform:function(a){a.scaleX=1;a.scaleY=1;a.skewX=0;a.skewY=0;a.setAngle(0)},_drawSelection:function(){var a= this.contextTop,e=this._groupSelector,d=e.left,g=e.top,h=c(d),k=c(g);a.fillStyle=this.selectionColor;a.fillRect(e.ex-(0c&&(c+=8);c+=k[a];d.shiftKey&&0===k[a]%2&&(c+=2);return this.cursorMap[c%8]}})})();(function(){var k=Math.min,h=Math.max;f.util.object.extend(f.Canvas.prototype,{_shouldGroup:function(d,a){var c=this.getActiveObject();return d.shiftKey&&a&&a.selectable&&(this.getActiveGroup()||c&&c!==a)&&this.selection},_handleGrouping:function(d,a){if(a===this.getActiveGroup()&&(a=this.findTarget(d, !0),!a||a.isType("group")))return;this.getActiveGroup()?this._updateActiveGroup(a,d):this._createActiveGroup(a,d);this._activeGroup&&this._activeGroup.saveCoords()},_updateActiveGroup:function(d,a){var c=this.getActiveGroup();if(c.contains(d)){if(c.removeWithUpdate(d),d.set("active",!1),1===c.size()){this.discardActiveGroup(a);this.setActiveObject(c.item(0));return}}else c.addWithUpdate(d);this.fire("selection:created",{target:c,e:a});c.set("active",!0)},_createActiveGroup:function(d,a){if(this._activeObject&& d!==this._activeObject){var c=this._createGroup(d);c.addWithUpdate();this.setActiveGroup(c);this._activeObject=null;this.fire("selection:created",{target:c,e:a})}d.set("active",!0)},_createGroup:function(d){var a=this.getObjects();d=a.indexOf(this._activeObject)a&&(d.width=b);d.height?d.height*=a:1>a&&(d.height= e);l?this._tempRemoveBordersControlsFromGroup(l):n&&this.deactivateAll&&this.deactivateAll();k=this.__toDataURL(k,h,d);this.width=c;this.height=g;this.setDimensions({width:c,height:g});l?this._restoreBordersControlsOnGroup(l):n&&this.setActiveObject&&this.setActiveObject(n);this.contextTop&&this.clearContext(this.contextTop);this.renderAll();return k},toDataURLWithMultiplier:function(f,h,d){return this.toDataURL({format:f,multiplier:h,quality:d})},_tempRemoveBordersControlsFromGroup:function(f){f.origHasControls= f.hasControls;f.origBorderColor=f.borderColor;f.hasControls=!0;f.borderColor="rgba(0,0,0,0)";f.forEachObject(function(f){f.origBorderColor=f.borderColor;f.borderColor="rgba(0,0,0,0)"})},_restoreBordersControlsOnGroup:function(f){f.hideControls=f.origHideControls;f.borderColor=f.origBorderColor;f.forEachObject(function(f){f.borderColor=f.origBorderColor;delete f.origBorderColor})}});(function(f){var h=f.fabric||(f.fabric={});f=h.util.object.extend;var d=h.util.toFixed,a=h.util.string.capitalize,c= h.util.degreesToRadians,g=h.StaticCanvas.supports("setLineDash");h.Object||(h.Object=h.util.createClass({type:"object",originX:"left",originY:"top",top:0,left:0,width:0,height:0,scaleX:1,scaleY:1,flipX:!1,flipY:!1,opacity:1,angle:0,skewX:0,skewY:0,cornerSize:12,transparentCorners:!0,hoverCursor:null,padding:0,borderColor:"rgba(102,153,255,0.75)",cornerColor:"rgba(102,153,255,0.5)",centeredScaling:!1,centeredRotation:!0,fill:"rgb(0,0,0)",fillRule:"nonzero",globalCompositeOperation:"source-over",backgroundColor:"", stroke:null,strokeWidth:1,strokeDashArray:null,strokeLineCap:"butt",strokeLineJoin:"miter",strokeMiterLimit:10,shadow:null,borderOpacityWhenMoving:.4,borderScaleFactor:1,transformMatrix:null,minScaleLimit:.01,selectable:!0,evented:!0,visible:!0,hasControls:!0,hasBorders:!0,hasRotatingPoint:!0,rotatingPointOffset:40,perPixelTargetFind:!1,includeDefaultValues:!0,clipTo:null,lockMovementX:!1,lockMovementY:!1,lockRotation:!1,lockScalingX:!1,lockScalingY:!1,lockUniScaling:!1,lockSkewingX:!1,lockSkewingY:!1, lockScalingFlip:!1,stateProperties:"top left width height scaleX scaleY flipX flipY originX originY transformMatrix stroke strokeWidth strokeDashArray strokeLineCap strokeLineJoin strokeMiterLimit angle opacity fill fillRule globalCompositeOperation shadow clipTo visible backgroundColor alignX alignY meetOrSlice skewX skewY".split(" "),initialize:function(a){a&&this.setOptions(a)},_initGradient:function(a){!a.fill||!a.fill.colorStops||a.fill instanceof h.Gradient||this.set("fill",new h.Gradient(a.fill)); !a.stroke||!a.stroke.colorStops||a.stroke instanceof h.Gradient||this.set("stroke",new h.Gradient(a.stroke))},_initPattern:function(a){!a.fill||!a.fill.source||a.fill instanceof h.Pattern||this.set("fill",new h.Pattern(a.fill));!a.stroke||!a.stroke.source||a.stroke instanceof h.Pattern||this.set("stroke",new h.Pattern(a.stroke))},_initClipping:function(a){a.clipTo&&"string"===typeof a.clipTo&&(a=h.util.getFunctionBody(a.clipTo),"undefined"!==typeof a&&(this.clipTo=new Function("ctx",a)))},setOptions:function(a){for(var e in a)this.set(e, a[e]);this._initGradient(a);this._initPattern(a);this._initClipping(a)},transform:function(a,e){this.group&&this.canvas.preserveObjectStacking&&this.group===this.canvas._activeGroup&&this.group.transform(a);e=e?this._getLeftTopCoords():this.getCenterPoint();a.translate(e.x,e.y);a.rotate(c(this.angle));a.scale(this.scaleX*(this.flipX?-1:1),this.scaleY*(this.flipY?-1:1));a.transform(1,0,Math.tan(c(this.skewX)),1,0,0);a.transform(1,Math.tan(c(this.skewY)),0,1,0,0)},toObject:function(a){var e=h.Object.NUM_FRACTION_DIGITS, e={type:this.type,originX:this.originX,originY:this.originY,left:d(this.left,e),top:d(this.top,e),width:d(this.width,e),height:d(this.height,e),fill:this.fill&&this.fill.toObject?this.fill.toObject():this.fill,stroke:this.stroke&&this.stroke.toObject?this.stroke.toObject():this.stroke,strokeWidth:d(this.strokeWidth,e),strokeDashArray:this.strokeDashArray?this.strokeDashArray.concat():this.strokeDashArray,strokeLineCap:this.strokeLineCap,strokeLineJoin:this.strokeLineJoin,strokeMiterLimit:d(this.strokeMiterLimit, e),scaleX:d(this.scaleX,e),scaleY:d(this.scaleY,e),angle:d(this.getAngle(),e),flipX:this.flipX,flipY:this.flipY,opacity:d(this.opacity,e),shadow:this.shadow&&this.shadow.toObject?this.shadow.toObject():this.shadow,visible:this.visible,clipTo:this.clipTo&&String(this.clipTo),backgroundColor:this.backgroundColor,fillRule:this.fillRule,globalCompositeOperation:this.globalCompositeOperation,transformMatrix:this.transformMatrix?this.transformMatrix.concat():this.transformMatrix,skewX:d(this.skewX,e),skewY:d(this.skewY, e)};this.includeDefaultValues||(e=this._removeDefaultValues(e));h.util.populateWithProperties(this,e,a);return e},toDatalessObject:function(a){return this.toObject(a)},_removeDefaultValues:function(a){var e=h.util.getKlass(a.type).prototype;e.stateProperties.forEach(function(c){a[c]===e[c]&&delete a[c];"[object Array]"===Object.prototype.toString.call(a[c])&&"[object Array]"===Object.prototype.toString.call(e[c])&&0===a[c].length&&0===e[c].length&&delete a[c]});return a},toString:function(){return"#\x3cfabric."+ a(this.type)+"\x3e"},get:function(a){return this[a]},_setObject:function(a){for(var e in a)this._set(e,a[e])},set:function(a,e){"object"===typeof a?this._setObject(a):"function"===typeof e&&"clipTo"!==a?this._set(a,e(this.get(a))):this._set(a,e);return this},_set:function(a,e){if("scaleX"===a||"scaleY"===a)e=this._constrainScale(e);"scaleX"===a&&0>e?(this.flipX=!this.flipX,e*=-1):"scaleY"===a&&0>e?(this.flipY=!this.flipY,e*=-1):"width"===a||"height"===a?this.minScaleLimit=d(Math.min(.1,1/Math.max(this.width, this.height)),2):"shadow"!==a||!e||e instanceof h.Shadow||(e=new h.Shadow(e));this[a]=e;return this},setOnGroup:function(){},toggle:function(a){var e=this.get(a);"boolean"===typeof e&&this.set(a,!e);return this},setSourcePath:function(a){this.sourcePath=a;return this},getViewportTransform:function(){return this.canvas&&this.canvas.viewportTransform?this.canvas.viewportTransform:[1,0,0,1,0,0]},render:function(a,e){0===this.width&&0===this.height||!this.visible||(a.save(),this._setupCompositeOperation(a), e||this.transform(a),this._setStrokeStyles(a),this._setFillStyles(a),this.transformMatrix&&a.transform.apply(a,this.transformMatrix),this._setOpacity(a),this._setShadow(a),this.clipTo&&h.util.clipContext(this,a),this._render(a,e),this.clipTo&&a.restore(),a.restore())},_setOpacity:function(a){this.group&&this.group._setOpacity(a);a.globalAlpha*=this.opacity},_setStrokeStyles:function(a){this.stroke&&(a.lineWidth=this.strokeWidth,a.lineCap=this.strokeLineCap,a.lineJoin=this.strokeLineJoin,a.miterLimit= this.strokeMiterLimit,a.strokeStyle=this.stroke.toLive?this.stroke.toLive(a,this):this.stroke)},_setFillStyles:function(a){this.fill&&(a.fillStyle=this.fill.toLive?this.fill.toLive(a,this):this.fill)},_renderControls:function(a,e){if(!(!this.active||e||this.group&&this.group!==this.canvas.getActiveGroup())){e=this.getViewportTransform();var d=this.calcTransformMatrix(),d=h.util.multiplyTransformMatrices(e,d);e=h.util.qrDecompose(d);a.save();a.translate(e.translateX,e.translateY);this.group&&this.group=== this.canvas.getActiveGroup()?(a.rotate(c(e.angle)),this.drawBordersInGroup(a,e)):(a.rotate(c(this.angle)),this.drawBorders(a));this.drawControls(a);a.restore()}},_setShadow:function(a){if(this.shadow){var e=this.canvas&&this.canvas.viewportTransform[0]||1,c=this.canvas&&this.canvas.viewportTransform[3]||1;this.canvas&&this.canvas._isRetinaScaling()&&(e*=h.devicePixelRatio,c*=h.devicePixelRatio);a.shadowColor=this.shadow.color;a.shadowBlur=this.shadow.blur*(e+c)*(this.scaleX+this.scaleY)/4;a.shadowOffsetX= this.shadow.offsetX*e*this.scaleX;a.shadowOffsetY=this.shadow.offsetY*c*this.scaleY}},_removeShadow:function(a){this.shadow&&(a.shadowColor="",a.shadowBlur=a.shadowOffsetX=a.shadowOffsetY=0)},_renderFill:function(a){this.fill&&(a.save(),this.fill.gradientTransform&&a.transform.apply(a,this.fill.gradientTransform),this.fill.toLive&&a.translate(-this.width/2+this.fill.offsetX||0,-this.height/2+this.fill.offsetY||0),"evenodd"===this.fillRule?a.fill("evenodd"):a.fill(),a.restore())},_renderStroke:function(a){this.stroke&& 0!==this.strokeWidth&&(this.shadow&&!this.shadow.affectStroke&&this._removeShadow(a),a.save(),this.strokeDashArray?(1&this.strokeDashArray.length&&this.strokeDashArray.push.apply(this.strokeDashArray,this.strokeDashArray),g?(a.setLineDash(this.strokeDashArray),this._stroke&&this._stroke(a)):this._renderDashedStroke&&this._renderDashedStroke(a),a.stroke()):(this.stroke.gradientTransform&&a.transform.apply(a,this.stroke.gradientTransform),this._stroke?this._stroke(a):a.stroke()),a.restore())},clone:function(a, e){return this.constructor.fromObject?this.constructor.fromObject(this.toObject(e),a):new h.Object(this.toObject(e))},cloneAsImage:function(a){var e=this.toDataURL();h.util.loadImage(e,function(e){a&&a(new h.Image(e))});return this},toDataURL:function(a){a||(a={});var e=h.util.createCanvasElement(),c=this.getBoundingRect();e.width=c.width;e.height=c.height;h.util.wrapElement(e,"div");c=new h.StaticCanvas(e);"jpg"===a.format&&(a.format="jpeg");"jpeg"===a.format&&(c.backgroundColor="#fff");var d={active:this.get("active"), left:this.getLeft(),top:this.getTop()};this.set("active",!1);this.setPositionByOrigin(new h.Point(e.width/2,e.height/2),"center","center");e=this.canvas;c.add(this);a=c.toDataURL(a);this.set(d).setCoords();this.canvas=e;c.dispose();return a},isType:function(a){return this.type===a},complexity:function(){return 0},toJSON:function(a){return this.toObject(a)},setGradient:function(a,e){e||(e={});var c={colorStops:[]};c.type=e.type||(e.r1||e.r2?"radial":"linear");c.coords={x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2}; if(e.r1||e.r2)c.coords.r1=e.r1,c.coords.r2=e.r2;e.gradientTransform&&(c.gradientTransform=e.gradientTransform);for(var d in e.colorStops){var g=new h.Color(e.colorStops[d]);c.colorStops.push({offset:d,color:g.toRgb(),opacity:g.getAlpha()})}return this.set(a,h.Gradient.forObject(this,c))},setPatternFill:function(a){return this.set("fill",new h.Pattern(a))},setShadow:function(a){return this.set("shadow",a?new h.Shadow(a):null)},setColor:function(a){this.set("fill",a);return this},setAngle:function(a){var e= ("center"!==this.originX||"center"!==this.originY)&&this.centeredRotation;e&&this._setOriginToCenter();this.set("angle",a);e&&this._resetOrigin();return this},centerH:function(){this.canvas.centerObjectH(this);return this},centerV:function(){this.canvas.centerObjectV(this);return this},center:function(){this.canvas.centerObject(this);return this},remove:function(){this.canvas.remove(this);return this},getLocalPointer:function(a,e){e=e||this.canvas.getPointer(a);a=new h.Point(e.x,e.y);e=this._getLeftTopCoords(); this.angle&&(a=h.util.rotatePoint(a,e,h.util.degreesToRadians(-this.angle)));return{x:a.x-e.x,y:a.y-e.y}},_setupCompositeOperation:function(a){this.globalCompositeOperation&&(a.globalCompositeOperation=this.globalCompositeOperation)}}),h.util.createAccessors(h.Object),h.Object.prototype.rotate=h.Object.prototype.setAngle,f(h.Object.prototype,h.Observable),h.Object.NUM_FRACTION_DIGITS=2,h.Object.__uid=0)})("undefined"!==typeof p?p:this);(function(){var k=f.util.degreesToRadians,h={left:-.5,center:0, right:.5},d={top:-.5,center:0,bottom:.5};f.util.object.extend(f.Object.prototype,{translateToGivenOrigin:function(a,c,g,b,e){var k=a.x,l=a.y;c=h[b]-h[c];g=d[e]-d[g];if(c||g)l=this._getTransformedDimensions(),k=a.x+c*l.x,l=a.y+g*l.y;return new f.Point(k,l)},translateToCenterPoint:function(a,c,d){c=this.translateToGivenOrigin(a,c,d,"center","center");return this.angle?f.util.rotatePoint(c,a,k(this.angle)):c},translateToOriginPoint:function(a,c,d){c=this.translateToGivenOrigin(a,"center","center",c, d);return this.angle?f.util.rotatePoint(c,a,k(this.angle)):c},getCenterPoint:function(){var a=new f.Point(this.left,this.top);return this.translateToCenterPoint(a,this.originX,this.originY)},getPointByOrigin:function(a,c){var d=this.getCenterPoint();return this.translateToOriginPoint(d,a,c)},toLocalPoint:function(a,c,d){var b=this.getCenterPoint();c=c&&d?this.translateToGivenOrigin(b,"center","center",c,d):new f.Point(this.left,this.top);a=new f.Point(a.x,a.y);this.angle&&(a=f.util.rotatePoint(a, b,-k(this.angle)));return a.subtractEquals(c)},setPositionByOrigin:function(a,c,d){a=this.translateToCenterPoint(a,c,d);a=this.translateToOriginPoint(a,this.originX,this.originY);this.set("left",a.x);this.set("top",a.y)},adjustPosition:function(a){var c=k(this.angle),d=this.getWidth(),b=Math.sin(c)*d;this.left+=Math.cos(c)*d*(h[a]-h[this.originX]);this.top+=b*(h[a]-h[this.originX]);this.setCoords();this.originX=a},_setOriginToCenter:function(){this._originalOriginX=this.originX;this._originalOriginY= this.originY;var a=this.getCenterPoint();this.originY=this.originX="center";this.left=a.x;this.top=a.y},_resetOrigin:function(){var a=this.translateToOriginPoint(this.getCenterPoint(),this._originalOriginX,this._originalOriginY);this.originX=this._originalOriginX;this.originY=this._originalOriginY;this.left=a.x;this.top=a.y;this._originalOriginY=this._originalOriginX=null},_getLeftTopCoords:function(){return this.translateToOriginPoint(this.getCenterPoint(),"left","top")}})})();(function(){function k(a){return[new f.Point(a.tl.x, a.tl.y),new f.Point(a.tr.x,a.tr.y),new f.Point(a.br.x,a.br.y),new f.Point(a.bl.x,a.bl.y)]}var h=f.util.degreesToRadians,d=f.util.multiplyTransformMatrices;f.util.object.extend(f.Object.prototype,{oCoords:null,intersectsWithRect:function(a,c){var d=k(this.oCoords);return"Intersection"===f.Intersection.intersectPolygonRectangle(d,a,c).status},intersectsWithObject:function(a){return"Intersection"===f.Intersection.intersectPolygonPolygon(k(this.oCoords),k(a.oCoords)).status},isContainedWithinObject:function(a){var c= a.getBoundingRect();a=new f.Point(c.left,c.top);c=new f.Point(c.left+c.width,c.top+c.height);return this.isContainedWithinRect(a,c)},isContainedWithinRect:function(a,c){var d=this.getBoundingRect();return d.left>=a.x&&d.left+d.width<=c.x&&d.top>=a.y&&d.top+d.height<=c.y},containsPoint:function(a){var c=this._getImageLines(this.oCoords);a=this._findCrossPoints(a,c);return 0!==a&&1===a%2},_getImageLines:function(a){return{topline:{o:a.tl,d:a.tr},rightline:{o:a.tr,d:a.br},bottomline:{o:a.br,d:a.bl}, leftline:{o:a.bl,d:a.tl}}},_findCrossPoints:function(a,c){var d,b,e,f=0,h;for(h in c)if(e=c[h],!(e.o.y=a.y&&e.d.y>=a.y)&&(e.o.x===e.d.x&&e.o.x>=a.x?d=e.o.x:(d=(e.d.y-e.o.y)/(e.d.x-e.o.x),b=a.y-0*a.x,e=e.o.y-d*e.o.x,d=-(b-e)/(0-d)),d>=a.x&&(f+=1),2===f))break;return f},getBoundingRectWidth:function(){return this.getBoundingRect().width},getBoundingRectHeight:function(){return this.getBoundingRect().height},getBoundingRect:function(){this.oCoords||this.setCoords();return f.util.makeBoundingBoxFromPoints([this.oCoords.tl, this.oCoords.tr,this.oCoords.br,this.oCoords.bl])},getWidth:function(){return this._getTransformedDimensions().x},getHeight:function(){return this._getTransformedDimensions().y},_constrainScale:function(a){return Math.abs(a)a?-this.minScaleLimit:this.minScaleLimit:a},scale:function(a){a=this._constrainScale(a);0>a&&(this.flipX=!this.flipX,this.flipY=!this.flipY,a*=-1);this.scaleY=this.scaleX=a;this.setCoords();return this},scaleToWidth:function(a){var c=this.getBoundingRect().width/ this.getWidth();return this.scale(a/this.width/c)},scaleToHeight:function(a){var c=this.getBoundingRect().height/this.getHeight();return this.scale(a/this.height/c)},setCoords:function(){var a=h(this.angle),c=this.getViewportTransform(),d=this._calculateCurrentDimensions(),b=d.x,e=d.y;0>b&&(b=Math.abs(b));var d=Math.sin(a),k=Math.cos(a),l=0a?-f:f); c&&(d+=0>d?-f:f);return{x:d,y:a}},_getTransformedDimensions:function(h,d){"undefined"===typeof h&&(h=this.skewX);"undefined"===typeof d&&(d=this.skewY);var a=this._getNonTransformedDimensions(),c=a.x/2,a=a.y/2,c=[{x:-c,y:-a},{x:c,y:-a},{x:-c,y:a},{x:c,y:a}];d=this._calcDimensionsTransformMatrix(h,d,!1);for(h=0;hb&&(b=f)}return b},_renderChars:function(a,b,c,d,f){var g=a.slice(0,-4);if(this[g].toLive){var h=-this.width/2+this[g].offsetX||0,k=-this.height/2+this[g].offsetY||0;b.save();b.translate(h,k);d-=h;f-=k}b[a](c,d,f);this[g].toLive&&b.restore()},_renderTextLine:function(a,b,c,d,f,g){f-=this.fontSize*this._fontSizeFraction;var h=this._getLineWidth(b,g);if("justify"!==this.textAlign||this.widthd)this.bitrate=1E3/c*(b-this.loaded)*8,this.loaded=b,this.timestamp=a;return this.bitrate}},_isXHRUpload:function(a){return!a.forceIframeTransport&&(!a.multipart&& c.support.xhrFileUpload||c.support.xhrFormDataFileUpload)},_getFormData:function(a){var b;return"function"===c.type(a.formData)?a.formData(a.form):c.isArray(a.formData)?a.formData:"object"===c.type(a.formData)?(b=[],c.each(a.formData,function(a,c){b.push({name:a,value:c})}),b):[]},_getTotal:function(a){var b=0;c.each(a,function(a,c){b+=c.size||1});return b},_initProgressObject:function(a){var b={loaded:0,total:0,bitrate:0};a._progress?c.extend(a._progress,b):a._progress=b},_initResponseObject:function(a){var b; if(a._response)for(b in a._response)a._response.hasOwnProperty(b)&&delete a._response[b];else a._response={}},_onProgress:function(a,b){if(a.lengthComputable){var d=Date.now?Date.now():(new Date).getTime(),e;b._time&&b.progressInterval&&d-b._time=f)return e.error=a.i18n("uploadedBytes"),this._getXHRPromise(!1,a.context,[null,"error",e.error]);q=function(){var b=c.extend({},a),p=b._progress.loaded;b.blob=k.call(e,h,h+g,e.type);b.chunkSize=b.blob.size;b.contentRange="bytes "+h+"-"+(h+b.chunkSize-1)+"/"+f;d._initXHRData(b); d._initProgressListener(b);n=(!1!==d._trigger("chunksend",null,b)&&c.ajax(b)||d._getXHRPromise(!1,b.context)).done(function(e,g,k){h=d._getUploadedBytes(k)||h+b.chunkSize;p+b.chunkSize-b._progress.loaded&&d._onProgress(c.Event("progress",{lengthComputable:!0,loaded:h-b.uploadedBytes,total:h-b.uploadedBytes}),b);a.uploadedBytes=b.uploadedBytes=h;b.result=e;b.textStatus=g;b.jqXHR=k;d._trigger("chunkdone",null,b);d._trigger("chunkalways",null,b);hd._sending)for(a=d._slots.shift();a;){if("pending"===d._getDeferredState(a)){a.resolve();break}a=d._slots.shift()}0===d._active&&d._trigger("stop")})};this._beforeSend(a,k);return this.options.sequentialUploads||this.options.limitConcurrentUploads&&this.options.limitConcurrentUploads<= this._sending?(1m||k&&f+1-r>=k)l.push(h.slice(r,f+1)),n=q.slice(r,f+1),n.length||(n=q),t.push(n),r=f+1,n=0}else t=q;else for(l=[],t=[],f=0;fa.maxNumberOfFiles?e.error=d.i18n("maxNumberOfFiles"):!a.acceptFileTypes||a.acceptFileTypes.test(e.type)||a.acceptFileTypes.test(e.name)?f>a.maxFileSize?e.error=d.i18n("maxFileSize"):"number"===c.type(f)&&f=y.text().replace(/\s/g,"").length}var y,t,g,z,m;(function(){y=b(".ac-price-value");t=e.getRealm();g=f.getConfig(t);var d=c.state("currencyConfig");d&&(g=d);z=c.state("priceInfo");m=parseFloat(z.basePrice);a()&&k.error("No price value set in the buybox","ac:buybox:price:controller")})();return{getPrice:function(){return m},setPrice:l,setPriceViewModel:d,modifyPrice:function(a){a&&l(m+a*z.exchangeRate)},isPriceViewModelEmpty:a}}var d=void 0;return{instance:function(){d|| (d=l());return d},cleanUp:function(){d=v}}});"use strict";r.when("A","fabric-js","ac:area","ac-base","ac-utils","ac-constants","ac:util:canvas","ac:widget:widget-lifecycle-event","jQuery").register("ac:canvas:canvas-creator",function(c,b,e,k,n,f,l,d,q){function p(a){return a.map(function(a,b){return{areaData:a,index:b}}).sort(function(a,b){var m=a.areaData,c=b.areaData;if(m.customizationType===c.customizationType)return a.index-b.index;if("Options"===m.customizationType)return-1;if("Options"===c.customizationType)return 1})} function a(a,g,d){var m,e,p,k;"Options"===g.customizationType?(m=f.optionImageDefaults.imageTop,e=f.optionImageDefaults.imageLeft,p=f.optionImageDefaults.canvasHeight,k=f.optionImageDefaults.imageWidth):(m=g.specifications.position.y,e=g.specifications.position.x,p=g.specifications.dimension.height,k=g.specifications.dimension.width);g=n.getScaleRatio();var y=q("\x3ccanvas/\x3e");y.attr({id:a,top:m*g,left:e*g,width:k*g,height:p*g+5});y.addClass("canvasArea");d.append(y);a=new b.Canvas(a);l.supportTouchManipulation(a); l.onCanvasObjectSelected(a,function(a){c.trigger("ac:canvas:object:selected",a)});l.onCanvasObjectDeselected(a,function(a){c.trigger("ac:canvas:object:deselected",a)});y.parent(".canvas-container").css({position:"absolute",top:m*g+"px",left:e*g+"px"});return a}function y(a,g){function b(a,g,m){a=a.getPlacementDataForScaleRatio(m);g.style.top="-"+a.top+"px";g.style.left="-"+a.left+"px";g.style.width=f.defaults.maskWidth*m+"px";g.style.height=f.defaults.maskHeight*m+"px"}if(g&&g.url){var m=new Image; m.crossOrigin="anonymous";m.className+="ac-mask-image";b(a,m,a.scaleRatio);m.style.maxWidth="none";m.style.maxHeight="none";m.onload=function(){q(a.canvas.lowerCanvasEl).after(m)};m.src=g.url;d.bindEventHandler(a.id+":preview:resized",function(g){b(a,m,g)})}}return{generateChildAreasWithCanvases:function(b,g,c,m){var d=p(b);b=[];d.forEach(function(d){var f=d.areaData;d=g+"-area-"+d.index;var l=a(d,f,m);d=new e(l,c,d,f);b.push(d)});b[0].isActive=!0;c.templateSurfaceData.mask&&y(b[b.length-1],c.templateSurfaceData.mask); return b}}});"use strict";r.when("A","jQuery").register("ac:designer:clear-button-controller",function(c,b){function e(){k||(k=b(".pc-two-column-layout .ac-delete-button"));return k}var k=void 0;return{show:function(){e().css("visibility","visible")},hide:function(){e().css("visibility","hidden")},onClear:function(b){e().click(b)},cleanUp:function(){k=v}}});"use strict";r.when("A","jQuery","ac-utils","ac-constants","ac-error-handling","ac:widget:widget-lifecycle-event","ac:util:media-services","ready").register("ac:customer:image:controller", function(c,b,e,k,n,f,l){var d=function(){function d(a){q(a.$thumbnail);c.trigger(k.events.ADD_CUSTOMER_IMAGE,a);var b=k.defaults.thresholdImageWidth,m=k.defaults.thresholdImageHeight,f=a.originalHeight,e=a.originalWidth;a=f>e?f:e;f=f>e?e:f;n.hide();f)([\s\S]*?)(<\/tspan>)/g,"$1\x3c![CDATA[$2]]\x3e$3")}var a=c.$,y=[4,4],t=c.capabilities.touch?20:12;return{addHoverAndSelectedStatesToCanvas:function(a){f(a);q(a)},canvasToSVG:function(d,f){var m=new e.Canvas("acTempCanvas"),l=b.outputSVGDimensions;m.setDimensions(l);m.clear();var k=parseInt(a(d.wrapperEl).css("top").replace("px",""),10),t=parseInt(a(d.wrapperEl).css("left").replace("px",""),10), n=void 0;d.forEachObject(function(a){a=e.util.object.clone(a);if("rect"!==a.type&&("text"!==a.type||""!==c.trim(a.text))){m.calcOffset();m.add(a);"image"===a.type&&(a.sendToBack(),n=a.getSrc());a.top+=k;a.left+=t;var b=l.width/f.width,d=l.height/f.height;a.scaleX*=b;a.scaleY*=d;a.left*=b;a.top*=d;a.setCoords()}});m.renderAll();if(n&&-1!==n.indexOf("._")&&-1!==n.indexOf("_.")){var q=n.split("._")[0]+"."+n.split("_.")[1];return m.toSVG(null,function(a){a=a.replace(/xlink:href="\S*"/,'xlink:href\x3d"'+ q+'"');return p(a)})}return m.toSVG(null,function(a){return p(a)})},resetActiveObjectIfOutsideCanvas:function(a,b){var d=a.getActiveObject();if(d){var c=a.width,f=a.height,l=new e.Rect({left:0,top:0,width:c,height:f,opacity:0}),k=new e.Point(0,0),n=new e.Point(0+c,0+f);a.add(l);k=d.intersectsWithObject(l)||l.isContainedWithinObject(d)||d.isContainedWithinRect(k,n);a.remove(l);k||(d.set({left:0+(c/2-d.width/2),top:0+(f/2-d.height/2),scaleX:1,scaleY:1,angle:0}),d.setCoords(),"function"===typeof b&& b())}},resizeCanvas:function(a,b){b.width&&a.setWidth(b.width);b.height&&a.setHeight(b.height)},positionCanvas:function(b,d){b=a(b.lowerCanvasEl).parent();d.top&&b.css({top:d.top});d.left&&b.css({left:d.left})},supportTouchManipulation:function(a){a.selection=!1;var b=function(){a.allowTouchScrolling=!1;a.upperCanvasEl.style.touchAction="none"},d=function(){a.allowTouchScrolling=!0;a.upperCanvasEl.style.touchAction="auto"};a.off({"object:selected":b,"selection:cleared":d});a.on({"object:selected":b, "selection:cleared":d})},onCanvasObjectSelected:function(a,b){a.on({"object:selected":b})},onCanvasObjectDeselected:function(a,b){a.on({"selection:cleared":b})}}});"use strict";r.register("ac:util:media-services",function(){var c=/\.[^.$]+$/;return{scaleImageAlongLongestSide:function(b,e){e="SL"+e;return b.replace(c,"")+"._"+e+"_"+b.match(c)}}});"use strict";r.when("A").register("ac:widget:widget-lifecycle-event",function(c){var b=[];return{bindEventHandler:function(e,k){b.push({name:e,handler:k}); c.on(e,k)},bindDeclarativeAction:function(e,k,n){b.push({name:"a:declarative:"+e+":"+k});c.declarative(e,k,n)},removeBindings:function(){b.forEach(function(b){var k=b.name;(b=b.handler)?c.off(k,b):c.off(k)});b=[]}}});"use strict";r.when("A","AmazonCustom:BrowserSpecific:DisableBFCache","ready").register("ac-base",function(c,b){function e(){return c.capabilities.mobile}function k(){return 1<=f(".ac-mobile-app").length}function n(){return 1<=f(".ac-tablet-app").length}var f=c.$;b.attachPageReloader(); c.on("pc-single-text-loaded",function(){c.capabilities.canvas?f(".pc-customization-disabled").remove():(f(".pc-customization-disabled").addClass("active"),f(".pc-customization-enabled").remove())});c.on("amazon-custom-popup-open",function(){this.popupOpenTime=new Date});c.on("amazon-custom-popup-close",function(b){x.ue.count("pcSingleTextTimer",(b-this.popupOpenTime)/1E3);x.ue.count("pcSingleTextTimer")});return{isDetailPage:function(){return 0a?(k.error("The calculatedScaleRatio "+a+" is invalid"),0):a}return 1};d.getFileExtension=function(a){a=/^.+\.([^.]+)$/.exec(a);return null===a?"":"."+a[1].toLowerCase()};d.cleanUp=function(){q=v};d.init=function(){l();q=f("wssStringArray");p=b(".ac-preview-container")};return d});"use strict";r.when("A","jQuery","a-button","fabric-js","ac-base","ac:buybox:buybox-controller", "ac:designer:make-your-own-controller","ac:designer:clear-button-controller","ac-surface","ac:gallery:seller-gallery","ac:customer:image:upload:form:controller","ac-utils","acc-util","ac-constants","ac:buybox:price:controller","ac:widget:widget-lifecycle-event","ready").register("ac-widget",function(c,b,e,k,n,f,l,d,q,p,a,r,t,g,z,m){return function(){function e(){d.onClear(function(){u.getActiveArea().controls.imageTextInput.clearActiveObject();d.hide()})}function k(){b(".customize-next-btn").click(function(a){a= u.getActiveSurface().surfaceIndex+1;a>u.surfaces.length-1&&(a=0);c.trigger("ac:surface:activate",{surfaceIndex:a});r.scrollToTop()})}function w(){b(".ac-surface-selector-container").delegate(".ac-surface-selector","click",function(a){a.preventDefault();a=b(this).data("surface-index");c.trigger("ac:surface:activate",{surfaceIndex:a})});m.bindEventHandler("ac:surface:activate",function(a){a=u.surfaces[a.surfaceIndex];a.isActive||(u.getActiveSurface().deactivateSurface(),a.activateSurface())})}function v(){b(".preview-customization").click(function(){r.scrollToTop()})} function x(){m.bindEventHandler(g.events.ADD_GALLERY_IMAGE,function(a){u.getActiveArea().controls.imageTextInput.addGalleryImage(a)})}function A(){m.bindEventHandler(g.events.ADD_CUSTOMER_IMAGE,function(a){u.getActiveArea().controls.imageTextInput.addCustomerImage(a)})}function B(){b("#pcTextArea").bind("keyup",function(){var a=b(this).val().replace(/"/g,"''");b(this).val(a);if(50b.which)&&d.length>=a&&(b.preventDefault(),p.val(d.substring(0,a)))});p.bind("keyup",function(a){d(a.target.value)});p.bind("change",function(a){d(a.target.value)});p.bind("drop",function(){var a=p.val();setTimeout(function(){p.val()!==a&&d(p.val())},0)});p.bind("cut",function(a){setTimeout(function(){d(a.target.value)},100)});p.bind("paste",function(a){setTimeout(function(){d(a.target.value)},100)})})();q.hasRequiredField()||g.hide();return q}});"use strict"; r.when("A","a-popover","ac-utils","ac-base","ready").register("ac:color-picker",function(c,b,e,k){var n=c.$;return function(c,e){function d(a){p.notifySubscribers("colorpicker",a)}function q(){r.bind("click",function(){var e=n(this).find("div"),g=e.attr("data-color"),e=e.attr("data-name");a.css("background-color",g);d({colorValue:g,colorName:e});b.get(c.find(".ac-color-picker-trigger").parent()).hide()})}var p,a,r;(function(){p=e;a=c.find(".ac-simplecolorpicker");r=c.find(".ac-color-li");var b=n(".ac-is-single-color"); b.length===n(".ac-controls-container").length?(d({colorValue:b.attr("data-color"),colorName:b.attr("data-name")}),k.isApp()&&c.hide()):(q(),b=c.find(".ac-color-li div"),d({colorValue:b.attr("data-color"),colorName:b.attr("data-name")}))})()}});"use strict";r.when("A","a-dropdown","ac-base","ready").register("ac:font-picker",function(c,b,e){return function(c,e){function f(){l.change(function(){e.notifySubscribers("fontpicker",{fontFamily:l.val(),fontName:l.find("option:selected").text()})})}var l; (function(){l=c.find("select");var d=b.getSelect(l);f();d=d.getOption(0).info()[0];e.notifySubscribers("fontpicker",{fontFamily:d.value,fontName:d.text})})()}});"use strict";r.when("A","a-dropdown","ac-utils","ac-base","ac:buybox:price:controller","ready").register("ac-configurator-picker",function(c,b,e,k,n){return function(c,e,d){function q(){x="notSelected";m="";w={value:0,currency:"USD"};v=""}function p(a){if(a){var b=C.possibleValues;z=g;(g=b.filter(function(b){return b.optionName===a})[0])? (m=g.optionId,w=g.priceDelta,v=g.optionImage):q();e.renderPreview();k.isApp()&&e.surface.updateTicker()}b=void 0;b=z?w.value-z.priceDelta.value:w.value;r.modifyPrice(b)}var a={},r,t,g,z,m,v,x,w,C,F,A,B;a.emphasizeMissingField=function(){B.addClass("pc-drop-down-error");A.addClass("a-color-error")};a.hasRequiredField=function(){return!!C.isRequired};a.requiredFieldsAreValid=function(){return a.hasRequiredField()?a.isValid():!0};a.isValid=function(){return x&&"notSelected"!==x};a.fulfillmentJSON=function(){return{optionId:m, optionValue:x,optionImage:v,priceDelta:w,label:C.label}};C=d;r=n.instance();F=c.find("select");A=c.find(".isRequiredLabel");B=c.find(".ac-configurator-dropdown");t=b.getSelect(F);e.enableBuyBox=!0;q();(function(){F.change(function(){x=t.val();p(x);B.removeClass("pc-drop-down-error");A.removeClass("a-color-error")})})();a.hasRequiredField()||A.hide();return a}});"use strict";r.when("A","ready").register("ac-constants",function(){return{AssetType:{IMAGE:"image"},StatusCode:{NON_HTML5_BROWSER:"NON-HTML5-BROWSER", NON_IMAGE_TYPE:"NON-IMAGE-TYPE",INVALID_FILE_TYPE:"INVALID_FILE_TYPE",READ_SUCCESS:"READ-SUCCESS",READ_NOT_REQUIRED:"READ_NOT_REQUIRED",INVALID_FILESIZE:"INVALID-FILE-SIZE"},defaults:{thresholdImageWidth:50,thresholdImageHeight:50,sellerProvidedImageWidth:400,maskWidth:400,maskHeight:400},outputSVGDimensions:{height:3200,width:3200},imageUploadSizeLimitInMB:7,textDefaults:{fontFamily:"Arial, Helvetica, sans-serif",fontWeight:"normal",fontStyle:"normal",textDecoration:"none",textAlign:"left",fill:"#FF9900", text:"",angle:0,opacity:1,fontSize:20},optionImageDefaults:{imageWidth:400,imageHeight:400,canvasHeight:395,imageLeft:0,imageTop:0,angle:0},events:{ADD_CUSTOMER_IMAGE:"addCustomerImage",ADD_GALLERY_IMAGE:"addGalleryImage",CANVAS_UPDATED:"ac:canvas:updated",CUSTOMER_IMAGE_SELECTED:"ac:customer:image:selected"},emojiMatchPattern:/[\u2600-\u27BF]|\uD83C[\uDDE0-\uDFFF]|\uD83D[\uDC00-\uDE4F]|\uD83E[\uDD00-\uDDFF]|\uD83D[\uDE80-\uDEFF]/}});"use strict";"use strict";r.when("A","a-alert","ac-base","ac-utils", "ready").register("ac-error-handling",function(c,b,e,k){function n(b){switch(b){case "warning":return"pc-generic-warning-text";default:return"pc-error-generic-text"}}return{show:function(c,l){var d=c?-1!==["pc-error-generic-text","pc-resolution-warning","pc-scale-warning-message","pc-generic-warning-text"].indexOf(c)?"warning":"error":l.type,q=k.stringHandler(n(d));c=c?k.stringHandler(c):l.message;var p=b(".ac-error-container");p.heading(q).text(c).type(d).show();e.isMobile()&&k.scrollToTop();l&& l.timeOut&&setTimeout(function(){p.hide()},parseInt(l.timeOut,10))},hide:function(){b(".ac-error-container").hide()}}});"use strict";r.when("A","a-button","a-dropdown","fabric-js","ac-base","ac-utils","ac-constants","ac:designer:make-your-own-controller","ac:designer:clear-button-controller","ready").register("ac-image-text",function(c,b,e,k,n,f,l,d,q){var p=c.$;return function(a){function k(a){c.each(C,function(b,c){b.setStatus(c===a?"selected":"normal")})}function n(b){return function(){a.clear(); b()}}function g(b){a.viewModel.imageData&&a.viewModel.imageData.isCustomerImage||a.viewModel.textData?f.showDialog(f.stringHandler("pc-clear-custom-msg"),n(b),{ok:"Clear"}):b()}function r(b){a.viewModel.imageData&&!a.viewModel.imageData.isCustomerImage?f.showDialog(f.stringHandler("pc-clear-design-msg"),n(b),{ok:"Clear"}):b()}function m(b){a.viewModel.textData=p.extend(a.viewModel.textData,b);a.viewModel.textData.text&&(a.viewModel.textData.isActive=!0,a.viewModel.imageData&&(a.viewModel.imageData.isActive= !1),h&&(a.viewModel.textData.fill||(a.viewModel.textData.fill=B),a.viewModel.textData.fontFamily||(a.viewModel.textData.fontFamily=A)));a.renderPreview();v()}function x(){a.viewModel.imageData=null;v()}function v(){a.enableBuyBox=a.viewModel.textData&&a.viewModel.textData.text||a.viewModel.imageData?!0:!1}var w={},C,F,A,B,u,E,D,G,h;w.addCustomerImage=function(b){r(function(){G.fadeIn();a.viewModel.imageData=p.extend(a.viewModel.imageData,b);a.viewModel.imageData.isActive=!0;a.viewModel.textData&& (a.viewModel.textData.isActive=!1);f.imageLoading.show();a.renderPreview().pipe(function(a){f.imageLoading.hide();v()})})};w.addGalleryImage=function(b){g(function(){G.fadeOut();a.viewModel.imageData=p.extend(a.viewModel.imageData,b);f.imageLoading.show();a.renderPreview().pipe(function(a){f.imageLoading.hide();q.show();v();u.disableTextInput()})})};w.activateTextAdd=function(){r(function(){w.updateControl();u.focusTextInput()})};w.updateObjectPlacement=function(b){"text"===b.type?a.viewModel.textData= p.extend(a.viewModel.textData,b):a.viewModel.imageData=p.extend(a.viewModel.imageData,b);a.renderPreview()};w.changeFont=function(a){m({fontFamily:a})};w.changeAlign=function(a){m({textAlign:a})};w.changeTextColor=function(a){D.css("background-color",a);m({fill:a})};w.editText=function(a){m({text:a})};w.resetTextControl=function(){E.val("");k("left");h&&(F.setValue(A),D.css("background-color",B))};w.updateControl=function(){a.viewModel.textData?(E.val(a.viewModel.textData.text),k(a.viewModel.textData.textAlign), h&&(F.setValue(a.viewModel.textData.fontFamily),D.css("background-color",a.viewModel.textData.fill))):w.resetTextControl()};w.clearActiveObject=function(){a.canvas.forEachObject(function(b){b.isActive&&("text"===b.type?(a.viewModel.textData=null,w.resetTextControl(),v()):x())});a.viewModel.imageData&&!a.viewModel.imageData.isCustomerImage&&(x(),u.enableTextInput());a.renderPreview()};w.cleared=function(){a.viewModel.textData=null;w.resetTextControl();v();x();u.enableTextInput();a.renderPreview()}; w.hasRequiredField=function(){return!1};w.requiredFieldsAreValid=function(){return!0};w.containsEmoji=function(){return l.emojiMatchPattern.test(E.val())};C={left:new b(p(".pc-text-leftAlign")[0]),center:new b(p(".pc-text-centerAlign")[0]),right:new b(p(".pc-text-rightAlign")[0])};if(h=a.getCustomizationTypeSettings().isCustomTextSupported&&a.surface.templateSurfaceData.FontSettings)F=e.getSelect("fontPicker"),A=F.getOption(0).info()[0].value,B=a.surface.templateSurfaceData.FontSettings.colors[0].value; u=d.instance();E=p("#pcTextArea");D=p(".simplecolorpicker.icon");G=p(".ac-upload-tnC");w.resetTextControl();return w}});"use strict";r.when("A","ac:util:metrics").execute("ac-popover-metrics",function(c,b){c.on("a:popover:afterShow:amazoncustom-buybox-widget",function(){b.incrementCounter("opened-modal")});c.on("a:popover:dismiss:amazoncustom-buybox-widget",function(){b.incrementCounter("closed-modal")})})}); /* ******** */ (function(b){var c=window.AmazonUIPageJS||window.P,d=c._namespace||c.attributeErrors,a=d?d("AmazonCustomBuyBoxAssets@asset",""):c;a.guardFatal?a.guardFatal(b)(a,window):a.execute(function(){b(a,window)})})(function(b,c,d){b.when("ac:view-factory","ac-ajax-customizer").execute("ac:olp:init",function(a,b){(new b({viewFactory:a,viewName:"amazoncustom-buybox-widget",deviceType:"web"})).init(!0)});"use strict";b.when("a-modal").register("ac:view-factory",function(a){return a})}); /* ******** */ (function(c){var e=window.AmazonUIPageJS||window.P,k=e._namespace||e.attributeErrors,b=k?k("AmazonsChoiceAssets",""):e;b.guardFatal?b.guardFatal(c)(b,window):b.execute(function(){c(b,window)})})(function(c,e,k){c.when("A","a-popover","ready").execute(function(b,c){var g=b.$;g(document).delegate("#why-we-love-this-product-link","click mouseenter",function(b){c.get(g("#ac-badge-popover-declarative")).show();b.preventDefault()})});"use strict";c.when("A","atf","dp-refresh-handler","twisterModule","ac-state-utils").execute(function(b, c,g,l,f){f.addACStateParamsToPageRefreshAjaxUrl()});"use strict";c.when("A","atf","dp-refresh-handler","ready").register("ac-state-utils",function(b,c,g){return{addACStateParamsToPageRefreshAjaxUrl:function(){var c={featureName:"acBadge"},f=b.$,d=b.state("acState");if(d){var a={};d.acAsin&&(a.acAsin=d.acAsin);d.modalityMetadata&&(a.ac_md=d.modalityMetadata);f.isEmptyObject(a)||(new g(c)).addParams(a)}}}});c.when("A","ready").execute(function(b){e.submitACFeedback=function(b,c,e,f,d,a){var h={};h.asin= c;h.query=b;h.customerFeedback=e;h.deviceType=f;h.modalityType=d;h.modalityDescription=a;return ue.event(h,"amazons_choice","amazons_choice.AmazonsChoiceDPXFeedback.2")};e.emitACPopoverShownEvent=function(b,c,e,f,d){var a={};a.asin=c;a.query=b;a.deviceType=e;a.modalityType=f;a.modalityDescription=d;return ue.event(a,"amazons_choice","amazons_choice.AmazonsChoicePopoverShown.2")}});c.when("A","a-modal").execute(function(b,c){var g=b.$;g.support.cors=!0;var k,f,d="Good";b.on("a:popover:show:amazons-choice-popover", function(a){k=a.popover;try{var c=b.state("ac-feedback-desktop");e.emitACPopoverShownEvent(c.acKeywords,c.acAsin&&0=a||!c())return null;var d={hours:Math.floor(a/3600),minutes:Math.floor(a%3600/60),seconds:a%60};c="";c=1e)){var f=this;this.endTime=this.getCurrentTime()+e;this.expirationCallback=a;this.displayElement=b;this.displayEnabled=!!d;this.formatFunction=c;this.update();this.currentTimer=setInterval(function(){f.update()},6E4)}} a.prototype.update=function(){var a=this.endTime-this.getCurrentTime();0>a&&(a=0);this.updateDisplay(a);0===a&&("function"===typeof this.expirationCallback&&this.expirationCallback(),this.destroy())};a.prototype.updateDisplay=function(a){this.displayElement&&this.displayEnabled&&(this.displayElement.innerHTML=this.getCountdownDisplay(Math.floor(a/3600),Math.floor(a%3600/60),a%60))};a.prototype.getCountdownDisplay=function(a,b,c){return"function"===typeof this.formatFunction?this.formatFunction(a, b,c):a+"h "+b+"m "+c+"s"};a.prototype.enableDisplay=function(){this.displayEnabled=!0;this.update()};a.prototype.disableDisplay=function(a){this.displayEnabled=!1;a&&this.displayElement&&(this.displayElement.innerHTML="")};a.prototype.getCurrentTime=function(){return Math.floor(+new Date/1E3)};a.prototype.destroy=function(){clearTimeout(this.currentTimer)};return{Countdown:a}})}); /* ******** */ (function(r){var f=window.AmazonUIPageJS||window.P,m=f._namespace||f.attributeErrors,c=m?m("ABPricingFreeFormQuantityPickerAssets",""):f;c.guardFatal?c.guardFatal(r)(c,window):c.execute(function(){r(c,window)})})(function(r,f,m){r.when("jQuery","A","ready").execute(function(c,h){function p(c){f.ue!==m&&f.ue.count!==m&&f.ue.count(c,(f.ue.count(c)||0)+1)}function k(){return h.state("ABPricingFreeFormQuantityPicker")}function g(c,d){return 0!==c.find('option[value\x3d"'+d.toString()+'"]').length}function n(){q|| k()===m||(q=!0,r.register("abPricingFfqp_utils",function(){return{PACKAGE_PREFIX:"ABPricingFreeFormQuantityPicker",getPageState:k,incrementMetricByOne:p,dropdownContainsQuantity:g}}))}var q=!1;n();r.register("abPricingFfqp_lazyInitializer",function(){return{tryInitialize:n}})});"use strict";r.when("jQuery","A","abPricingFfqp_utils").register("abPricingFfqp_quantityManager",function(c,h,p){function k(l){for(var a="",b=0;b=this.leastMinimumOrderQuantity)){var a=c(".price3P");a.hasClass("updatedPrice3P")||(a.addClass("updatedPrice3P"),this.quantityChangePriceUpdater.ajaxCall({qt:this.leastMinimumOrderQuantity, quantityPriceField:"quantity_price"}))}};d.prototype.handleTwisterPageRefresh=function(){this.update3PPriceBlock()};d.prototype.reloadPageForQuantity=function(a,b){var c={};c.qty=a;c.psc=1;b!==m&&(b.refTag!==m&&(c.ref_=b.refTag),b.activeBuyBoxId!==m&&(c.selectObb=b.activeBuyBoxId));f.location.href=q(c)};d.prototype.notifyQuantityChanged=function(a,c){h.trigger("buyBoxQuantityChanged",c.senderId,a);this.currentQuantity=a;e(a);if(!0!==c.preventRefreshCheck){var d=this,u=p.getPageState();h.trigger("quantityRefreshCheckStarted"); h.get("/gp/product/ajax-handlers/quantity-page-refresh.html",{params:{asin:u.asin,quantity:a,refreshData:u.lastRefreshData,activeBuyBoxId:c.activeBuyBoxId},timeout:4E3,error:function(){p.incrementMetricByOne(b);d.reloadPageForQuantity(a,{activeBuyBoxId:c.activeBuyBoxId})},success:function(){h.trigger("quantityRefreshCheckFinished")}})}};d.prototype.fetchAllTiersForQuantityDiscountTable=function(){var b=p.getPageState();"T1"===b.weblab_DPX_AB_VAP_NEW_QUANTITY_PICKER_210547&&h.get("/gp/product/ajax-handlers/quantity-price-table.html", {params:{ref:"b2b_vqp_tiers",asin:b.asin,cb:k(20),qptResponseFormat:"json"},timeout:4E3,error:function(){p.incrementMetricByOne(a)},success:function(a){h.trigger("fetchQuantityDiscountTableCompleted",a)}})};d.prototype.updateLimitedAvailabilityMessageVisibility=function(a){h.trigger("updateLimitedAvailabilityMessageVisibility",a.hasAvailability)};return{EVENT__BUY_BOX_QUANTITY_CHANGED:"buyBoxQuantityChanged",EVENT__QUANTITY_REFRESH_CHECK_STARTED:"quantityRefreshCheckStarted",EVENT__QUANTITY_REFRESH_CHECK_FINISHED:"quantityRefreshCheckFinished", EVENT__FETCH_QUANTITY_DISCOUNT_TABLE_COMPLETED:"fetchQuantityDiscountTableCompleted",EVENT__UPDATE_LIMITED_AVAILABILITY_MESSAGE_VISIBILITY:"updateLimitedAvailabilityMessageVisibility",getUrlParameter:g,replaceUrlParameter:n,singleton:new d}});"use strict";r.when("jQuery","A","a-dropdown","a-button","abPricingFfqp_utils","abPricingFfqp_quantityManager").register("abPricingFfqp_quantityPickerLogic",function(c,h,f,k,g,n){function q(b){return b.prop("selectedIndex")+1===b.prop("length")}function e(b, a){if(!g.dropdownContainsQuantity(b,a)){var l=document.createElement("option");l.value=a;l.text=a.toString();b.append(l)}}function d(b){this.id=b.id;this.buyBoxId=b.buyBoxId;this.quantityHiddenFieldSelector=b.quantityHiddenFieldSelector;this.leastMinimumOrderQuantity=b.leastMinimumOrderQuantity;this.predefinedQuantitiesDropdownSelector=b.predefinedQuantitiesDropdownSelector;this.predefinedQuantitiesDropdownContainerSelector=b.predefinedQuantitiesDropdownContainerSelector;this.freeQuantityTextInputSelector= b.freeQuantityTextInputSelector;this.freeQuantityTextInputOuterSelector=b.freeQuantityTextInputOuterSelector;this.updateButtonSelector=b.updateButtonSelector;this.addToCartButtonSelector=b.addToCartButtonSelector;this.initialQuantity=b.initialQuantity;this.buyingOptionPosition=b.buyingOptionPosition;this.limitedAvailabilityMessageSelector=b.limitedAvailabilityMessageSelector;this.initialQuantity&&this.updateQuantityHiddenField(this.initialQuantity);this.wireUpSelectorBasedEvents()}d.prototype.wireUpSelectorBasedEvents= function(){var b=this,a=c(this.predefinedQuantitiesDropdownSelector);h.on("a:dropdown:"+a[0].id+":select",function(a){b.handleDropdownOptionClicked(a.value)});h.on(n.EVENT__BUY_BOX_QUANTITY_CHANGED,function(a,c){b.handleQuantityChangedOnOtherBuyBox(a,c)});h.on(n.EVENT__QUANTITY_REFRESH_CHECK_STARTED,function(){b.handleQuantityRefreshCheckStarted()});h.on(n.EVENT__QUANTITY_REFRESH_CHECK_FINISHED,function(){b.handleQuantityRefreshCheckFinished()});h.on(n.EVENT__UPDATE_LIMITED_AVAILABILITY_MESSAGE_VISIBILITY, function(a){b.updateLimitedAvailabilityMessageVisibility(a)})};d.prototype.wireUpReferenceBasedEvents=function(){var b=this,a=c(this.freeQuantityTextInputSelector),l=c(this.updateButtonSelector);a.keydown(function(a){b.handleTextInputKeyDown(a)});a.keyup(function(a){b.handleTextInputKeyUp(a)});a.focus(function(){b.handleTextInputFocused()});l.click(function(){b.handleButtonClick()})};d.prototype.attachToDOM=function(){this.wireUpReferenceBasedEvents();q(c(this.predefinedQuantitiesDropdownSelector))? this.switchToFreeQuantityUI():this.switchToPredefinedQuantitiesUI();this.enableUI();this.lastSelectedQuantity=this.getCurrentQuantity();n.singleton.leastMinimumOrderQuantity=this.leastMinimumOrderQuantity};d.prototype.getCurrentQuantity=function(){if(this.isTextInputVisible()){var b=c(this.freeQuantityTextInputSelector);return parseInt(b.val())}return this.isDropdownVisible()?(b=c(this.predefinedQuantitiesDropdownSelector),parseInt(b.find(":selected").val())):m};d.prototype.handleQuantityRefreshCheckStarted= function(){this.doesDOMExist()&&this.disableUI()};d.prototype.handleQuantityRefreshCheckFinished=function(){this.doesDOMExist()&&this.enableUI()};d.prototype.handleDropdownOptionClicked=function(b){var a=c(this.predefinedQuantitiesDropdownSelector);q(a)?(b=c(this.freeQuantityTextInputSelector),b.val(this.lastSelectedQuantity.toString()),this.switchToFreeQuantityUI(),b.focus(),g.incrementMetricByOne("freeFormQtyPickerMaxQtySelected")):(this.lastSelectedQuantity=b=parseInt(b),this.updateQuantityHiddenField(b), n.singleton.notifyQuantityChanged(b,{senderId:this.id,activeBuyBoxId:this.buyBoxId}))};d.prototype.handleTextInputFocused=function(){c(this.freeQuantityTextInputSelector).select()};d.prototype.handleTextInputKeyUp=function(b){13!==b.keyCode&&k(this.updateButtonSelector).show()};d.prototype.handleTextInputKeyDown=function(b){13===b.keyCode&&(b.preventDefault(),c(this.updateButtonSelector).click(),c(this.addToCartButtonSelector).focus())};d.prototype.clampQuantity=function(b){999d);){var e=this.priceTiers[b];c.push({quantity:0===d?Math.max(a,e.quantity):e.quantity,savingsMessage:e.savingsMessage,quantityPickerPriceText:e.quantityPickerPriceText,isDiscountUnlocked:0===d?0===b&&"BUSINESS_VOLUME_AWARE_PRICING"===e.program:!1,isFirstTier:0===d});d++;b++}return c}; e.prototype.findStartIndexOfQuantityDiscountTierTable=function(a){for(var b=0,c=this.priceTiers.length-1;b<=c;){var d=parseInt((b+c)/2),e=n(this.priceTiers[d].quantity);if(e===a)return d;e>a?c=d-1:b=d+1}return Math.max(0,c)};e.prototype.generateQuantityDiscountTable=function(){this.cleanOutQuantityDiscountTable();var a=c(this.quantityDiscountTableSelector);this.priceTiers===m?a.append(this.generateFetchInProcessTableUnorderedList()):a.append(this.generateQuantityDiscountTableUnorderedList())};e.prototype.cleanOutQuantityDiscountTable= function(){c(this.quantityDiscountTableSelector).empty()};e.prototype.generateQuantityDiscountTableUnorderedList=function(){var a=c(this.quantityTextInputSelector),b=n(a.val()),a=this.findStartIndexOfQuantityDiscountTierTable(b),b=this.generateVisibleTiersList(b,a),d=document.createElement("ul");d.setAttribute("class","qdt-ul");for(var e=c(d),f=0;f=f&&a.each(c,function(a){b.push(a)})});return b},getAllRecommendations:function(){return this._getRecommendations(0)},getNewRecommendations:function(){return this._getRecommendations(this._unprocessedChunkIndex)},getRecommendationBaseIdentifier:function(){return this._recommendationBaseIdentifier},addRecommendationChunk:function(f){var b=[]; a.each(f,function(a){a.widgetType=a.widgetType||g.widgetType.RECOMMENDATION_WIDGET});b=h.merge(b,this._dataChunks);b=h.merge(b,[f]);return new k(this._recommendationBaseIdentifier,b,this._dataChunks.length)}};f=new k;return b.registerStore(c,function(a,f){var c=a,h=g.actions;switch(f.getName()){case h.USS_OPEN:b.getDispatcher().waitFor([d.getDispatchToken()]);d.getState().getActionSource()===g.actionSources.DP_ATC_CLICK&&(c=new k(d.getState().getRecommendationBaseIdentifier()));break;case h.RECOMMENDATION_DATA_RECEIVE:h= d.getState().getRecommendationBaseIdentifier(),f=f._metadata,f.recommendationBaseIdentifier===h&&(c=a.addRecommendationChunk(f.widgets))}return c},f)});e.when("uss-store-repository","dp-flux-attribution","uss-constants").register("uss-sheet-store",function(a,b,c){function d(a,f,b){this._isSheetOpen=a||!1;this._actionSource=f;this._recommendationBaseIdentifier=b}var g=c.actions,k=c.ussCTI;b=new b(c.stores.USS_SHEET_STORE,k.CATEGORY,k.TYPE,k.ITEM);d.prototype={isSheetOpen:function(){return this._isSheetOpen}, getActionSource:function(){return this._actionSource},getRecommendationBaseIdentifier:function(){return this._recommendationBaseIdentifier}};k=new d(!1);return a.registerStore(b,function(a,f){var b=a;switch(f.getName()){case g.USS_OPEN:a.isSheetOpen()||(f.getSource()===c.actionSources.DP_ATC_CLICK?b=new d(!0,f.getSource(),f.getMetaData().recommendationBaseIdentifier):f.getSource()===c.actionSources.USS_INGRESS_CLICK&&a.getRecommendationBaseIdentifier()&&(b=new d(!0,f.getSource(),a.getRecommendationBaseIdentifier()))); break;case g.USS_CLOSE:a.isSheetOpen()&&(b=new d(!1,f.getSource(),a.getRecommendationBaseIdentifier()))}return b},k)});e.when("A","uss-store-repository","dp-flux-attribution","uss-constants","dp-flux-utils").register("uss-atc-status-store",function(a,b,c,d,g){function k(){this.status=void 0;this.cart={subTotal:{}};this.mainImage={};this.isAtcGenericError=this.shippingMessageHTML=this.imbHTML=void 0}a=new c("uss-atc-status-store",d.ussCTI.CATEGORY,d.ussCTI.TYPE,d.ussCTI.ITEM);k.prototype={setStatus:function(a){this.status= 1===a||a===d.classList.ATC_SUCCESS?d.classList.ATC_SUCCESS:d.classList.ATC_ERROR},setCart:function(a,f,b){g.isNonEmptyString(a)&&(this.cart.count=parseInt(a));f&&(this.cart.subTotal=f);g.isNonEmptyString(b)&&(this.cart.checkoutUrl=b)},setMainImage:function(a,f){g.isNonEmptyString(a)&&(this.mainImage.src=a,g.isNonEmptyString(f)?this.mainImage.altText:this.mainImage.altText="")},setImbHTML:function(a){g.isNonEmptyString(a)&&(this.imbHTML=a)},setShippingMessageHTML:function(a){g.isNonEmptyString(a)&& (this.shippingMessageHTML=a)},setIsAtcGenericError:function(a){this.isAtcGenericError=a}};c=new k;b.registerStore(a,function(a,f){var b=a;switch(f.getName()){case d.actions.ATC_RECEIVE:var c=f.getMetaData();f.getSource()===d.actionSources.DP_ATC_CLICK?(b=new k,c.isAtcGenericError?b.setIsAtcGenericError(!0):(b.setStatus(c.status),b.setCart(c.cart.count,c.cart.subTotal,c.cart.checkoutUrl),b.setMainImage(c.mainImage.src,c.mainImage.altText),b.setImbHTML(c.imbHTML),b.setShippingMessageHTML(c.shippingMessageHTML))): f.getSource()!==d.actionSources.USS_INLINE_ATC_CLICK||c.isAtcGenericError||(b=new k,b.setStatus(a.status),b.setMainImage(a.mainImage.src,a.mainImage.altText),b.setImbHTML(a.imbHTML),b.setShippingMessageHTML(a.shippingMessageHTML),c.cart&&b.setCart(c.cart.count,c.cart.subTotal,a.cart.checkoutUrl));break;case d.actions.USS_OPEN:f.getSource()===d.actionSources.DP_ATC_CLICK&&(b=new k)}return b},c)});e.when("A","uss-constants").register("uss-template-store",function(a,b){var c=a.$,d=b.classList,g={};return{init:function(){var a= c("."+d.TEMPLATE_STORE),b;1===a.length&&a.find("."+d.TEMPLATE).each(function(a,p){b=c("\x3cdiv\x3e\x3c/div\x3e");p=c(p);b.append(p);(a=p.data(d.TEMPLATE_NAME))&&(g[a]=b.html())})},getTemplate:function(a){return g[a]},_nameToTemplateMap:g}});e.when("A","dp-flux-attribution","dp-flux-utils","uss-store-repository","uss-widget","uss-constants").register("uss-widget-factory",function(a,b,c,d,g,k){var h=a.$,f={};f[k.widgetType.WIDGET]=g;a=k.ussCTI;var p=new b("uss-widget-factory",a.CATEGORY,a.TYPE,a.ITEM); return{registerWidgetType:function(a,b){if(!c.isNonEmptyString(a))throw Error("uss-widget-factory.registerWidgetType()... : name parameter must be valid string. provided name param is \x3d "+a);if(!(b.prototype instanceof g))throw Error("uss-widget-factory.registerWidgetType()... : constructor.prototype must be instance of Widget. provided constructor param is \x3d "+b);f[a]=b},getWidgetType:function(a){return f[a]},getWidget:function(a){var c,d=p;try{var g=a.widgetType||k.widgetType.WIDGET,l=f[g]; if(!l)return e.log("Widget.getWidget()... : Constructor not exist for type : "+g,"FATAL",d.getAttribution()),c;var A=l.getAttribution&&l.getAttribution();A&&(d=A);if(a.attribution)var w=a.attribution,d=new b(w.name,w.category,w.type,w.item);var m=h(a.content),n=h("\x3cdiv\x3e\x3c/div\x3e");n.append(m);c=new l(d,n)}catch(x){e.log("Widget.getWidget()... : "+x.message,"FATAL",d.getAttribution&&d.getAttribution())}return c}}});e.when("A","uss-constants","dp-flux-view","uss-store-repository","uss-dispatcher").register("uss-widget", function(a,b,c,d,g){function k(b){var f=[];a.each(b,function(a){var b=d.getStore(a);if(b)f.push(b);else throw Error("Widget.getWidget().getStores()... : store with name \x3d "+a+" not exists");});return f}var h=b.classList,f=b.widgetType;return a.createClass({init:function(a,b){this._element=b;this._element.addClass(f.WIDGET);this._element.addClass(h.HIDE_ELEMENT);this._attribution=a;this._dispacther=g;this.getStoreNames().length&&(b=k(this.getStoreNames()),this._fluxView=new c(a,b,this.update.bind(this)), this.update(b))},show:function(f){f=f||{};f=f.showWidgetAnimation||{};var c=b.animationType;f.animationType=f.animationType||c.NO_ANIMATION;switch(f.animationType){case c.FADE_IN:a.fadeIn(this._element,f.timeDuration||100,f.transitionTimingFunction||b.transitionTimingFunction.EVEN_EASE);break;case c.NO_ANIMATION:this._element.addClass(h.SHOW_ELEMENT),this._element.removeClass(h.HIDE_ELEMENT)}},hide:function(){this._element.addClass(h.HIDE_ELEMENT);this._element.removeClass(h.SHOW_ELEMENT)},beforeRender:function(){}, afterRender:function(){},getElement:function(){return this._element},getAttribution:function(){return this._attribution},getDispatcher:function(){return this._dispacther},update:function(a){},getStoreNames:function(){return[]},deleteWidget:function(){this._element.remove();this._fluxView&&this._fluxView.unregisterStores()}})});e.when("A","uss-constants","uss-widget-factory","uss-logger-service").register("uss-recommendation-widget",function(a,b,c,d){var g=b.widgetType;a=c.getWidgetType(g.WIDGET); var k=b.classList,h=b.metrics;b=a.extend({init:function(a,b){this._super(a,b);this._element.addClass(g.RECOMMENDATION_WIDGET);this._addTrackingMetrics()},_addTrackingMetrics:function(){this._element.find("."+k.FACEOUT_IMAGE).click(function(){d.logCounter(h.FACEOUT_IMAGE_CLICK_COUNTER)});this._element.find("."+k.FACEOUT_REVIEW_STARS).click(function(){d.logCounter(h.FACEOUT_REVIEW_STARS_CLICK_COUNTER)});this._element.find("."+k.FACEOUT_PRICE).click(function(){d.logCounter(h.FACEOUT_PRICE_CLICK_COUNTER)}); this._element.find("."+k.FACEOUT_TITLE).click(function(){d.logCounter(h.FACEOUT_TITLE_CLICK_COUNTER)});this._element.find("."+k.FACEOUT_BEST_SELLER).click(function(){d.logCounter(h.FACEOUT_BEST_SELLER_CLICK_COUNTER)})}});c.registerWidgetType(g.RECOMMENDATION_WIDGET,b);return b});e.when("A","uss-constants","uss-widget-factory","dp-flux-attribution","uss-template-store","dp-flux-action","uss-logger-service").register("uss-no-recommendation-widget",function(a,b,c,d,g,k,h){var f=b.widgetType;a=c.getWidgetType(f.WIDGET); var e=b.ussCTI,t=new d(b.widgetType.NO_RECOMMENDATION_WIDGET,e.CATEGORY,e.TYPE,e.ITEM);d=a.extend({init:function(a,c){this._super(a,c);this._element.addClass(f.NO_RECOMMENDATION_WIDGET);a=g.getTemplate(b.widgetType.NO_RECOMMENDATION_WIDGET);this._element.append(a);this._continueShoppingLink=this._element.find("."+b.classList.CONTINUE_SHOPPING_LINK);this._continueShoppingLink.click(function(a){a.preventDefault();h.logCounter(b.metrics.CONTINUE_SHOPPING_CLICK);this.getDispatcher().dispatch(new k(b.actions.USS_CLOSE, b.actionSources.CONTINUE_SHOPPING_CLICK))}.bind(this))}});d.getAttribution=function(){return t};c.registerWidgetType(f.NO_RECOMMENDATION_WIDGET,d);return d});e.when("A","uss-constants","uss-widget-factory").register("primary-action-status-widget",function(a,b,c){var d=b.widgetType;a=c.getWidgetType(d.WIDGET).extend({init:function(a,b){this._super(a,b);this.getElement().addClass(d.PRIMARY_ACTION_STATUS_WIDGET)}});c.registerWidgetType(d.PRIMARY_ACTION_STATUS_WIDGET,a);return a});e.when("A","promising-ui-element", "uss-utils","uss-constants").register("promising-image",function(a,b,c,d){var g=a.$,k=d.classList;return b.extend({init:function(a,b){this._element=g(b);this._attribution=a;this._super(this._element);this._eventHandle=void 0},_showTickMarkImage:function(b){switch(b){case k.ATC_SUCCESS:this._showSuccessTickMark();break;case k.ATC_ERROR:this._showErrorTickMark();break;default:return}a.off(this._eventHandle.event,this._eventHandle.callback)},_showSuccessTickMark:function(){g(".main-image").find(".success-tick-mark-placeholder").addClass("success-tick-mark-image")}, _showErrorTickMark:function(){var b=g(".main-image").find(".error-tick-mark-placeholder");b.addClass("error-tick-mark-image");a.fadeIn(b,200,d.transitionTimingFunction.EASE_OUT)},showUIValue:function(b,f,k){var t=this,q=d.defaultAtcAnimationType,B=this._super.bind(this);q===d.animationType.FADE_IN&&(this._eventHandle=a.on(d.atcAnimationStatusEvent,this._showTickMarkImage.bind(this,k)));return c.loadImage(b,f).then(function(b){if(q===d.animationType.FADE_IN){var f=g(".main-image").find(".ui-promise"); a.fadeOut(f,200,d.transitionTimingFunction.EASE_IN,function(){t._appendImageToUIValue(b);B();var f=g(".main-image").find(".ui-value");a.fadeIn(f,200,d.transitionTimingFunction.EASE_OUT)})}else this._appendImageToUIValue(b),B();return!0}.bind(this),function(){e.log("PromisingImage.showUIValue() ... : failed to load image","FATAL",this._attribution.getAttribution());return!1}.bind(this))},_appendImageToUIValue:function(a){this.getValueElement().empty();this.getValueElement().append(a)}})});e.when("A", "promising-ui-element","uss-constants").register("atc-status-msg",function(a,b,c){var d=c.classList;return b.extend({init:function(a){this._atcStatusElement=a;this._super(this._atcStatusElement)},_showSuccessMessage:function(){this._atcStatusElement.addClass(d.ATC_SUCCESS);this._atcStatusElement.removeClass(d.ATC_ERROR);this._atcStatusElement.removeClass(d.ITEM_IN_CART)},_showFailureMessage:function(){this._atcStatusElement.addClass(d.ATC_ERROR);this._atcStatusElement.removeClass(d.ATC_SUCCESS);this._atcStatusElement.removeClass(d.ITEM_IN_CART)}, _showItemInCartMessage:function(){this._atcStatusElement.addClass(d.ITEM_IN_CART);this._atcStatusElement.removeClass(d.ATC_ERROR);this._atcStatusElement.removeClass(d.ATC_SUCCESS)},showUIValue:function(b){var k=this,h=c.defaultAtcAnimationType;switch(b){case d.ATC_SUCCESS:this._showSuccessMessage();break;case d.ATC_ERROR:this._showFailureMessage();break;case d.ITEM_IN_CART:this._showItemInCartMessage();break;default:return}this._super();h===c.animationType.FADE_IN&&(b=this._atcStatusElement.find("."+ d.UI_PROMISE),a.fadeOut(b,200,c.transitionTimingFunction.EASE_IN,function(){var b=k._atcStatusElement.find("."+d.UI_VALUE);a.fadeIn(b,200,c.transitionTimingFunction.EASE_OUT,function(){a.trigger(c.atcAnimationStatusEvent)})}))}})});e.when("A","promising-ui-element","uss-constants","dp-flux-utils").register("cart-status-message",function(a,b,c,d){var g=c.classList;return b.extend({init:function(a){this._cartStatusElement=a;this._subTotalElement=this._cartStatusElement.find("."+g.CART_SUB_TOTAL);this._cartCountElement= this._cartStatusElement.find("."+g.CART_COUNT);this._cartCountSingularTemplate=this._cartCountElement.data("cart-count-singular-template");this._cartCountPluralTemplate=this._cartCountElement.data("cart-count-plural-template");this._super(this._cartStatusElement);this._eventHandle=void 0},_atcAnimationStatusResolved:function(){setTimeout(function(){this._cartStatusElement.addClass("uss-c-cart-status-msg-transition");a.off(this._eventHandle.event,this._eventHandle.callback)}.bind(this),200)},showUIValue:function(b, g){var f=c.defaultAtcAnimationType;if("number"===typeof b&&d.isNonEmptyString(g)){var e;1===b?e=this._cartCountSingularTemplate.replace("###cartCount",b):1a?k:a,c!==k&&this.onBoundsAdjustedCallbacks.callAll(k))};a.prototype.$getIFrameContainer=function(){return b(this.IFRAME_CONTAINER_SELECTOR)};a.prototype.$getIFrame=function(){return b(this.IFRAME_CONTAINER_SELECTOR+" iframe")};a.prototype.pushBoundsAdjustedCallback=function(a){this.onBoundsAdjustedCallbacks.push(a)}; return{extend:function(){function b(){a.apply(this,arguments)}b.prototype=Object.create(a.prototype);return b.prototype.constructor=b}}});"use strict";g.when("turbo-configuration","turbo-checkout-page-ready").execute("turbo-eligible-state-check",function(d){d.get(d.KEYS.EXTEND_ELIGIBLE_STATE)||g.when("turbo-base-eligible-state").register("turbo-checkout-eligible-state",function(c){return{canShow:c.canShow,registerStateChangeCallback:c.registerStateChangeCallback,setup:c.setup}})});"use strict";g.when("A", "turbo-checkout-state-handler","turbo-configuration","turbo-checkout-utils","turbo-checkout-page-ready").register("turbo-checkout-weblab-allocation",function(d,c,a){function b(){return c.getWeblabAllocation()}function f(){return c.getExperimentName()}function e(){return"C"===b()}function h(){var b=a.get(a.KEYS.NO_PREFETCH_EXPERIMENT_WEBLABS);return Array.isArray(b)&&-1!==b.indexOf(f())&&!e()}return{getAllocation:b,getExperimentName:f,isControl:e,isBuyNowOnly:function(){return b()===a.get(a.KEYS.BUY_NOW_ONLY_TREATMENT)}, isPrefetch:function(){return!h()&&b()===a.get(a.KEYS.PREFETCH_TREATMENT)},isNoPrefetch:function(){var c=a.get(a.KEYS.NO_PREFETCH_TREATMENT);return h()||!!b().match(c)}}});"use strict";g.when("A","jQuery","turbo-checkout-ajax-wrapper","turbo-checkout-utils","turbo-checkout-urls","turbo-checkout-csm","turbo-checkout-weblab-allocation","turbo-checkout-buy-now-button","turbo-configuration","turbo-checkout-state-handler","turbo-checkout-eligibility-response-weblabs","turbo-checkout-page-ready").register("turbo-checkout-weblab-trigger", function(d,c,a,b,f,e,h,g,k,t,n){function p(){d.on("turbo:checkout:prefetch:onTurboEligible",function(){C=!0;H()})}function m(){d.on("turbo:checkout:prefetch:onTurboIneligible",function(){C=!1;H()})}function r(){d.on("a:pageUpdate",function(){H()})}function H(){0===u().length?e.logCount("turboCheckoutBuyNowButtonMissing"):0===w().length&&e.logCount("turboCheckoutBuyNowFormMissing");0a.readyState)r("Ignoring ready state changed event because headers already received or missing xhr");else if(K=!0,h.logCount("turboCheckoutPrefetchHeadersReceived"),h.logCount("turboCheckoutPrefetchHeadersReceivedDuration",Date.now()-J),y(a)){r("Headers received: Turbo eligible"); h.logCount("turboCheckoutTurboEligibleAfterCheetahChecks");var b=H(a),c=g.isSignInSupported();b&&(r("Headers received: Signin required"),h.logCount("turboCheckoutSigninRequired"),c||(r("Sign-in required but it is disabled or not supported."),h.logCount("turboCheckoutSigninNotSupported")));if(c||!b)r("Notifying turbo eligible callbacks"),P.callAll(),d.trigger("turbo:checkout:prefetch:onTurboEligible");u(a)&&F.callAll(a.getResponseHeader("x-amzn-checkout-login-provider"))}else r("Headers received: Not turbo eligible"), O.callAll(),d.trigger("turbo:checkout:prefetch:onTurboIneligible")});return a}function r(a,b){f.logDebug("turbo-checkout-content-loader",a,b)}function H(a){return a&&a.getResponseHeader("x-amzn-checkout-login-required")}function u(a){return g.isSignInSupported()&&H(a)}function w(a,b,c){h.logCount("turboCheckoutPrefetchEnd",Date.now()-J);C=null;b=y(c);var e,g=a&&a.match(x);if(g&&0.*<\/script>/, D=d.$,C,B="stopped",J,K=!1,L=c.create("onStart"),N=c.create("onFinish"),R=c.create("onError"),P=c.create("onTurboEligible"),O=c.create("onTurboIneligible"),F=c.create("onSigninRequired");d.on("turbo:checkout:signInController:onDoSignIn",v);return{registerCallback:function(a){L.push(a);N.push(a);R.push(a);P.push(a);F.push(a);O.push(a)},callInitiate:function(){r("Calling turbo initiate");t()},checkEligibility:function(){r("Calling turbo eligibility check only");t(!0)},abortCall:M,isSuccess:function(){return"success"=== B},isError:function(){return"error"===B},isStarted:function(){return"started"===B}}});"use strict";g.when("A","jQuery","turbo-checkout-ref-tagger","turbo-checkout-utils","turbo-checkout-page-ready").register("turbo-checkout-history-manager",function(d,c,a,b){function f(){if(l.history.state&&l.history.state.turboAction)return l.history.state.turboAction}c(l).bind("popstate.turbo",function(c){f();f()?(b.logDebug("turbo-checkout-history-manager","Trigger sheet open"),d.trigger("turbo:checkout:sheet:doOpen")): (b.logDebug("turbo-checkout-history-manager","Trigger sheet close"),d.trigger("turbo:checkout:sheet:doClose",{immediate:!1,reason:a.TAGS.BACK}))});return{sheetOpened:function(){f();f()||(b.logDebug("turbo-checkout-history-manager","Adding turbo history state"),l.history.pushState({turboAction:"popover"},document.title+" Turbo open"))},sheetClosed:function(){f();f()&&(b.logDebug("turbo-checkout-history-manager","Removing turbo history state"),l.history.back())}}});"use strict";g.when("A","turbo-checkout-page-ready").register("turbo-base-visibility-manager", function(d){function c(){d.trigger("turbo:checkout:page:gone")}return{setup:function(){d.on("turbo:checkout:sheet:onNavigateAway",c)}}});g.when("turbo-configuration","turbo-checkout-page-ready").execute("turbo-mash-will-reappear-check",function(d){d.get(d.KEYS.USES_MASH_WILL_REAPPEAR)||g.when("turbo-base-visibility-manager").register("turbo-checkout-page-visibility-manager",function(c){return c})});"use strict";g.when("A","jQuery","turbo-checkout-view-state","turbo-checkout-weblab-allocation","turbo-checkout-state-handler", "turbo-checkout-content-loader","turbo-checkout-prefetch-timer","turbo-checkout-page-visibility-manager","turbo-checkout-counter","turbo-checkout-utils","turbo-checkout-eligibility-aggregator","turbo-checkout-auto-open","turbo-checkout-page-ready").register("turbo-checkout-prefetcher",function(d,c,a,b,f,e,h,g,k,t,n,p){function m(a){var b=l;l=a;t.logDebug("turbo-checkout-prefetcher","Transitioning from "+b.name+" to "+a.name);if(b.onExit)b.onExit(a.name);if(a.onEnter)a.onEnter(b.name);d.trigger("turbo:checkout:prefetcher:state:"+ a.name);d.trigger("turbo:checkout:prefetcher:state",a.name)}var r,l,u=function(){var a=e.isError(),b=!n.isTurboEligible(),c=h.isTimeout(),d=0===r;t.logDebug("turbo-checkout-prefetcher","Test is data stale: isStaleWhenCheetahReturnsError: "+a+" isStaleWhenProductNotEligiblie: "+b+" isStaleWhenTimeoutOccurs: "+c+" isStaleWhenNoMorePrefetchesAvailable: "+d);return a||b||c||d},w=function(){var a=n.isTurboEligible()&&!h.isTimeout()&&0t.indexOf(a.namespace)}))&&0